How to use css text-overflow property

青灯夜游
Release: 2019-05-29 16:58:39
original
2819 people have browsed it

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

How to use css text-overflow property

css text-overflow属性怎么用?

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

语法:

text-overflow: clip|ellipsis|string;
Copy after login

属性值:

● 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
Copy after login

效果图:

How to use css text-overflow property

The above is the detailed content of How to use css text-overflow property. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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 [email protected]
Latest issues
Popular Tutorials
More>
Latest downloads
More>
web effects
Website source code
Website materials
Front end template
About us Disclaimer Sitemap
PHP Chinese website:Public welfare online PHP training,Help PHP learners grow quickly!