zoukankan      html  css  js  c++  java
  • HTML中显示的文字自动换行

    在html中控制自动换行

    http://www.cnblogs.com/zjxbetter/articles/1323449.html

    eg:

    <table>
    <tr>
    <td width="200" style="word-break:break-all;">asdfsasdfasd扩大发射点法打发深刻发射点激发的发觉山地飞机啊飞机莱塞解放龙卷风啊fasasdfsasdfasdfasasdfsasdfasdfasasdfsasdfasdfasasdfsasdfasdfasasdfsasdfasdfasasdfsasdfasdfas</td>
    </tr>
    </table>

    html中td自动换行

    head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    table
    
    {
     border-collapse: collapse;
     border: 1px black solid;
    }
    
    tr td
    
    {
     border: 1px black solid;
     height: 20px;
     text-align:center;
    }
    
    
    </style>
    </head>
    <body>
    <table width="500" rules="all" style="table-layout:fixed">
      <tr>
        <td width="200px" rowspan="2" style="word-wrap : break-word ">
      内容内容  内容内容  内容内容  内容内容  内容内容
     </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    </body>
    </html>
    View Code

     效果图

    关于Asp.Net label的强制换行

    第一种方法是直接引用样式:
    <style type="text/css">
     .label{word-wrap:break-word;word-break:keep-all;overflow:hidden;}
    </style>
    <asp:Label ID="Label3" runat="server" Width="350px" Text='<%# Bind("y_question") %>' CssClass="label"></asp:Label>
    复制代码
    第二种方法:查看页面源码发现,解析后的label标签为<span>
    
    所以在页面添加样式:
    
    <style type="text/css">
    span{word-break:break-all;}
    
    </style>
    
    <asp:Label ID="Label3" runat="server" Width="350px" Text='<%# Bind("y_question") %>' ></asp:Label>
     
    View Code
  • 相关阅读:
    关键C函数备录
    TCP/UDP编程步骤和区别
    Pro C/C++环境搭建
    linux常用命令和选项
    运行在linux上的mysql常用命令
    把指针作为形参,用于取值的用法
    Leetcode476.Number Complement数字的补数
    Leetcode463.Island Perimeter岛屿的周长
    Leetcode461Hamming Distance汉明距离
    Leetcode455.Assign Cookies分发饼干
  • 原文地址:https://www.cnblogs.com/51net/p/4649716.html
Copyright © 2011-2022 走看看