CSS3 text-overflow属性
作用:text-overflow 属性规定当文本溢出包括元素时发作的事变。
语法:
text-overflow: clip|ellipsis|string;
clip:修剪文本。
ellipsis:显现省略标记来代表被修剪的文本。
string:运用给定的字符串来代表被修剪的文本。
注:一切主流浏览器都支撑 text-overflow 属性。
CSS3 text-overflow属性的运用示例
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> div.test { white-space:nowrap; width:12em; overflow:hidden; border:1px solid #000000; } div.test:hover { text-overflow:inherit; overflow:visible; } </style> </head> <body> <p>将鼠标移动到框内,检察结果.</p> <div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div> <br> <div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</div> </body> </html>
结果图:
本文参考:https://www.html.cn/book/css/properties/user-interface/text-overflow.htm
以上就是text-overflow属性怎样用的细致内容,更多请关注ki4网别的相干文章!