[size=x-large][color=red]建议使用text-overflow:ellipsis;文本超出后以省略号形式显示[/color][/size]
[color=red][size=x-large]代码效果如下[/size][/color]
[img]http://dl2.iteye.com/upload/attachment/0122/5024/07be6213-3a73-3d62-8f9b-b5cec1122ac4.png[/img]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<style>
div.test
{
white-space:nowrap;
width:12em;
overflow:hidden;
border:1px solid #000000;
}
</style>
</head>
<body>
<p>以下 div 容器内的文本无法完全显示,可以看到它被裁剪了。</p>
<p>div 使用 "text-overflow:ellipsis":</p>
<div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div>
<p>div 使用 "text-overflow:clip":</p>
<div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</div>
<p>div 使用自定义字符串 "text-overflow: >>"(只在 Firefox 浏览器下有效):</p>
<div class="test" style="text-overflow:'>>';">This is some long text that will not fit in the box</div>
</body>
</html>
[color=red][size=x-large]代码效果如下[/size][/color]
[img]http://dl2.iteye.com/upload/attachment/0122/5024/07be6213-3a73-3d62-8f9b-b5cec1122ac4.png[/img]