对大片文字的显示样式进行限制是CSS中最常用的地方之一,比如以下几种情况:
强制不换行:
自动换行:
强制英文单词断行:
我们在行列时,经常会出现一行文字超出了宽度,很多人使用了 overflow:hidden,让超出来的内容隐藏,有没有一种代码让文字超出时,出现省略号了?
可以使用这种方法:兼容IE 火狐:overflow:hidden;white-space:nowrap; -o-text-overflow: ellipsis; text-overflow:ellipsis;
04 | <meta http-equiv= "Content-Type" content= "text/html; charset=gb2312" /> |
05 | <title>www.nowamagic.net</title> |
07 | div.wid{ width : 200px ;overflow : hidden ; white-space : nowrap ;text- overflow :ellipsis; -o-text- overflow :ellipsis;
} |
12 | <div class= "wid" ><a href= "#" target= "_blank" >避免表格table和DIV被撑开变形的CSS代码实例</a></div> |