美文网首页
2018-12-28CSS3 text-overflow怎么让多

2018-12-28CSS3 text-overflow怎么让多

作者: 1f658716b568 | 来源:发表于2018-12-28 15:03 被阅读0次

    在网页设计的时候,我们总会遇到一些现实文章内容简介的地方,如果内容简介特别字多的时候,我们需要省略标记,下面就介绍用css怎样实现这个功能。

    text-overflow

    CSS 中编写如下:

    <style type="text/css">
    .test_demo_clip{text-overflow:clip; overflow:hidden; white-space:nowrap; width:200px; background:#ccc;}
    .test_demo_ellipsis{text-overflow:ellipsis; overflow:hidden; white-space:nowrap; width:200px; background:#ccc;}
    </style>

    BODY中编写如下:

    <div class="test_demo_clip">
    不显示省略标记,而是简单的裁切条
    </div>

    <div class="test_demo_ellipsis">
    当对象内文本溢出时显示省略标记
    </div>

    相关文章

      网友评论

          本文标题:2018-12-28CSS3 text-overflow怎么让多

          本文链接:https://www.haomeiwen.com/subject/kgoslqtx.html