文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>CSS实现让的多余的文字出现省略号

CSS实现让的多余的文字出现省略号

时间:2010-08-15  来源:设计源

我们在行列时,经常会出现一行文字超出了宽度,很多人使用了

 overflow:hidden  让超出来的内容隐藏,有没有一种代码让文字超出时,出现省略号了?

答案是有

使用:white-space:nowrap;text-overflow:ellipsis; -o-text-overflow:ellipsis;

 

代码演示:

 

代码
<!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>设计源</title>
<style>
div.wid
{ width:200px;white-space:nowrap;text-overflow:ellipsis; -o-text-overflow:ellipsis; overflow: hidden;}
</style>
</head>

<body>
<div class="wid"><a href="http://www.websjy.com/bbs/forumdisplay.php?fid=9" target="_blank">避免表格table和DIV被撑开变形的CSS代码实例</a></div>
</body>
</html>

 

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载