在使用DIV+CSS技巧">CSS网页标准制作网页时,LI标签中内容超过长度后以省略号显示的方法。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><style type="text/css"><!-- li { width:200px; white-space:nowrap; text-overflow:ellipsis; -o-text-overflow:ellipsis; overflow: hidden; } /* firefox only */ li:not(p) { /* wtf is? pls let me know*/ clear: both; } li:not(p) a { max-width: 175px; float: left; } li:not(p):after { content: "..."; float: left; width: 25px; padding-left: 5px; color: #df3a0e; }
--></style><ul><li><a href="#">web标准常见问题大全web标准常见问题大全</a></li><li><a href="#">web标准常见问题大全web标准常见问题大全</a></li><li><a href="#">web标准常见问题大全web标准常见问题大全</a></li><li><a href="#">web标准常见问题大全web标准常见问题大全</a></li><li><a href="#">web标准常见问题大全web标准常见问题大全</a></li></ul>