css清除浮动and省略

195 阅读1分钟
一行省略:
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-break:break-all;
二行省略:
overflow : hidden;
text-overflow: ellipsis; 
display: -webkit-box; 
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-break:break-all;
字母数字换行:
word-break:break-all;
word-wrap:break-word;
清除浮动:
.clearfix:after{/*伪元素是行内元素 正常浏览器清除浮动方法*/
content: "";
display: block;
height: 0;
clear:both;
visibility: hidden;
}
.clearfix{
*zoom: 1;/*ie6清除浮动的方式 *号只有IE6-IE7执行,其他浏览器不执行*/
}
使用before和after双伪元素清除浮动
.clearfix:after,.clearfix:before{
content: "";
display: table;
}
.clearfix:after{
clear: both;
}
.clearfix{
*zoom: 1;
}