css li里的字符串长度小于li的宽度时,如何用省略号自动填充

html-css012

css li里的字符串长度小于li的宽度时,如何用省略号自动填充,第1张

text-overflow版本:IE6+专有属性 继承性:无

语法:

text-overflow : clip | ellipsis

参数:

clip :  不显示省略标记(...),而是简单的裁切

ellipsis :  当对象内文本溢出时显示省略标记(...)

说明:

设置或检索是否使用一个省略标记(...)标示对象内文本的溢出。

对应的脚本特性为textOverflow。请参阅我编写的其他书目。

示例:

div { text-overflow : clip}

overflow:hidden

text-overflow:ellipsis

white-space:nowrap

eg:<html>

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />

<title></title>

</head>

<style type="text/css">

div.test{

width:200px

height:100px

border:1px solid red

padding:10px

overflow:hidden

text-overflow:ellipsis

white-space:nowrap

}

</style>

<body>

<div class="test">

做自己的SEO 做自己的DIV+CSS 做自己的PHP

</div>

</body>

</html>