首頁  >  文章  >  web前端  >  css实现文本超出li宽度的部分隐藏_html/css_WEB-ITnose

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

WBOY
WBOY原創
2016-06-24 11:31:161182瀏覽

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/

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn