Home  >  Article  >  Web Front-end  >  css实现文本超出li宽度的部分隐藏_html/css_WEB-ITnose

css实现文本超出li宽度的部分隐藏_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:31:161222browse

css实现文本超出li宽度的部分隐藏:
在某些实际应用中,希望把文本超出的部分隐藏而非换行,下面就是一段这样的代码实例,大家可以参考一下。
代码如下:

<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>蚂蚁部落</title> <style type="text/css"> #content{  width:130px;  height:80px;  background-color:green;  white-space:nowrap;  text-overflow:ellipsis;   overflow:hidden;}</style> </head> <body> <div id="content">蚂蚁部落欢迎您,只有奋斗才会有美好的明天</div></body> </html>

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=9681

更多内容可以参阅:http://www.softwhy.com/divcss/

Statement:
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