如图 这种一行内标题字数不一致 该怎样控制?

解决方案 »

  1.   

    这样的情况,我宁愿考虑css控制而不是php控制
      

  2.   

    可以使用css控制,overflow:hidden;
      

  3.   

    <!DOCTYPE html >
    <html>
    <head>
    <meta charset="utf-8" />
    <title>无标题文档</title>
    <style type="text/css">
    *{margin:0;padding:0; list-style:none}
    html{ height:100%;}
    body{ font:normal 12px/24px Arial, Helvetica, sans-serif; color:#666; position:relative; height:100%;}
    a{ text-decoration:none; color:#999;}
    a:hover{color:#000}
    .text li{width:15em; height:1.5em; line-height:1.5em; overflow:hidden;color:#00F;}
    .text li a{ position:relative; display:block; width:13em; overflow: visible; word-break:break-all; word-wrap: break-word; }
    *+html .text li a{ overflow:hidden;white-space:nowrap; text-overflow:ellipsis; }<!--兼容ie-->
    *html .text li a{ overflow:hidden;white-space:nowrap;  text-overflow:ellipsis; }<!--兼容ie-->
    .text li a:after{ content:"..."; position:absolute;bottom:1.5em;right:-15px;}<!--兼容firefox opera-->
    </style>
    </head>
    <body>
    <ul class="text">
    <li><a href="#">ssssssssssssssssssssssssssssssssssssssss</a></li>
        <li><a href="#">这是一个很伤心的夜下着有些伤夜下着有些伤夜下雨</a></li>
        <li><a href="#">这是一个下伤心的雨</a></li>
        <li><a href="#">这伤心的有些伤心的雨</a></li>
        <li><a href="#">这是一个很sdfsdfsdfsdf下着有些有些有些的雨</a></li>
        <li><a href="#">这心的夜下着有些伤心的雨</a></li>
    </ul>
    </body>
    </html>
    网上找的 你可以试一下  
      

  4.   

    给标签加CSS如.label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}