CSS3文本溢出显示省略号_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:25:34
Original
1924 people have browsed it

CCS3属性之text-overflow:ellipsis;的用法和注意之处

语法:

text-overflow:clip | ellipsis

默认值:clip

适用于:所有元素

clip: 当对象内文本溢出时不显示省略标记(...),而是将溢出的部分裁切掉。 
ellipsis: 当对象内文本溢出时显示省略标记(...)。

更多参考:http://hovertree.com/h/bjaf/pr_text-overflow.htm

在使用的时候,有时候发现不会出现省略标记效果,经过测试发现,使用ellipsis的时候,必须配合overflow:hidden; white-space:nowrap; width:200px;这三个样式共同使用才会有效果,示例代码:

<style type="text/css">    .test{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:360px;}</style><div class="test">欢迎光临<a href="http://hovertree.com/">何问起</a>! hovertree.com css3实现文本溢出显示省略号。<a href="http://hovertree.net/">Midi下载</a></div>
Copy after login

查看效果:http://hovertree.com/h/bjaf/1hg11eg4.htm

练习题:http://hovertree.com/tiku/bjaf/curs4a42.htm

web前端汇总:

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template