当前位置: 代码迷 >> ASP.NET >> 关于lable换行style=word-break:break-all无效解决办法
  详细解决方案

关于lable换行style=word-break:break-all无效解决办法

热度:9257   发布时间:2013-02-25 00:00:00.0
关于lable换行style=word-break:break-all无效
HTML code
<asp:Label ID="lb_show" runat="server"             style="position:absolute; top: 196px; left: 88px; height: 16px; word-break:break-all"/></asp:Label>

C# code
    protected void btn_submit_Click(object sender, EventArgs e)    {        string message = string.Empty;        try        {            int min = Convert.ToInt32(txt_start.Text);            int max = Convert.ToInt32(txt_end.Text);            for (int i = min; i <= max; i++)            {                for (int j = min; j <= i; j++)                {                    message += string.Format("{0}*{1}={2} ", j, i, i * j);                }                message += "\r\n";            }        }        catch        {            message = "请输入正确数字";        }        lb_show.Text = message;    }

真纠结呀。。用一个lable不能换行了吗;
虽然可以用多个标签解决

------解决方案--------------------------------------------------------
<div style="width:500px;height:500px;word-break:break-all">
<asp:Literal ID="lbl_show" ... />
</div>
------解决方案--------------------------------------------------------
<asp:Label ID="lb_show" runat="server" 
style="position:absolute; top: 196px; left: 88px; height: 16px; width:xxpx; display:inline-block; word-wrap:break-word; word-break:break-all; overflow:hidden;"/></asp:Label>

这里1.设置宽度
2.设置display

上面两个是必须的; 

 try above, good luck
  相关解决方案