当前位置: 代码迷 >> HTML/CSS >> css文字超过宽度出现省份列号
  详细解决方案

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

热度:205   发布时间:2012-11-06 14:07:00.0
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>

?

?

效果:

?

  相关解决方案