css3 标题超过长度自动省略号

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>css文字截断____dowhatyouwant</title>
        <style>
            body{
                background-color:#f4f4f4;
                font-size:12px;
            }
            .text-overflow{
                width:200px;
                height:50px;
                border:1px solid red;
                border-top:4px solid red;
                padding:10px;
                overflow:hidden; /*内容超出宽度时隐藏超出部分的内容 */
                text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
                white-space:nowrap; /*不换行 */
            }
        </style>
    </head>
    <body>
        <div class='text-overflow'>我来测试一下这个文字截断是不是真的有效果我来测试一下这个文字截断是不是真的有效果我来测试一下这个文字截断是不是真的有效果我来测试一下这个文字截断是不是真的有效果我来测试一下这个文字截断是不是真的有效果我来测试一下这个文字截断是不是真的有效果</div>
    </body>
</html>

 

posted @ 2016-04-08 17:16  timelesszhuang  阅读(10814)  评论(0编辑  收藏  举报