读书人

运用CSS截断过长标题文字的方法

发布时间: 2013-02-03 12:33:31 作者: rapoo

使用CSS截断过长标题文字的方法

整理磁盘,发现这个小东东,发一文备忘。

测试文件test.html代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>使用CSS截断过长标题文字的方法</title><style type="text/css"><!--.htmer{width: 200px;white-space: nowrap;overflow: hidden;text-overflow:ellipsis;      /*兼容IE*/}--></style></head><body><div class="htmer">使用CSS截断过长标题文字的方法</div></body></html>

IE(V9.0)效果
运用CSS截断过长标题文字的方法

chrome(V8.0.552)效果:

运用CSS截断过长标题文字的方法

FireFox(V12.0)效果

运用CSS截断过长标题文字的方法

读书人网 >CSS

热点推荐