189 8069 5689

怎么使用csstext-overflow属性

本篇文章为大家展示了怎么使用css text-overflow属性,代码简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站建设、网站制作、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的青山湖网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

css text-overflow属性用于指定当文本溢出包含它的元素时,应该发生什么事情。所有主流浏览器都支持 text-overflow 属性。

css text-overflow属性怎么用?

text-overflow 属性规定当文本溢出包含元素时发生的事情。

语法:

text-overflow: clip|ellipsis|string;

属性值:

● clip:修剪文本。

● ellipsis:显示省略符号来代表被修剪的文本。

● string:使用给定的字符串来代表被修剪的文本。

注释:所有主流浏览器都支持 text-overflow 属性。

css text-overflow属性 示例




 



以下 div 容器内的文本无法完全显示,可以看到它被裁剪了。

div 使用 "text-overflow:ellipsis":

This is some long text that will not fit in the box

div 使用 "text-overflow:clip":

This is some long text that will not fit in the box

div 使用自定义字符串 "text-overflow: >>"(只在 Firefox 浏览器下有效):

This is some long text that will not fit in the box

效果图:

怎么使用css text-overflow属性

上述内容就是怎么使用css text-overflow属性,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注创新互联行业资讯频道。


标题名称:怎么使用csstext-overflow属性
分享URL:http://cdxtjz.cn/article/gejhpj.html

其他资讯