`
小小猪馁
  • 浏览: 18936 次
  • 性别: Icon_minigender_2
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

css文字超过宽度出现省列号

阅读更多

 

<!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=utf-8" />
<title>无标题文档</title>
<style type="text/css">
p:first-letter{ font-size:28px}  <!--ie6不支持伪类-->
</style>
</head>
<body>
<p style="width:100px; height:25px; line-height:25px;text-overflow:ellipsis;overflow:hidden; white-space:nowrap;">即可到圣诞节啥考试死定了</p>
<a style="display:inline-block;width:100px; height:25px; line-height:25px;text-overflow:ellipsis;overflow:hidden; white-space:nowrap;" href="#" title="即可到圣诞节啥考试死定了">即可到圣诞节啥考试死定了</a>
<!--要实现溢出时产生省略号的效果还须定义:强制文本在一行内显示(white-space:nowrap)及溢出内容为隐藏(overflow:hidden),只有这样才能实现溢出文本显示省略号的效果。 -->
支持所有的浏览器
</body>
</html>

 

 

效果:

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics