清除浮动时用到的伪类:after
利用伪类在元素前后添加其他内容时,伪类默认表现出行内元素的特性,所以设置height,width,margin上下,padding上下等属性是无效的,除非设置display:block;说以在清除浮动时,应该是:
.content:after{content:'.'; display: block; height: 0; line-height: 0; font-size: 0; visibility: hidden; clear: both;}
清除浮动时用到的伪类:after
利用伪类在元素前后添加其他内容时,伪类默认表现出行内元素的特性,所以设置height,width,margin上下,padding上下等属性是无效的,除非设置display:block;说以在清除浮动时,应该是:
.content:after{content:'.'; display: block; height: 0; line-height: 0; font-size: 0; visibility: hidden; clear: both;}
本文标题:关于伪类的特性
本文链接:https://www.haomeiwen.com/subject/ybapvftx.html
网友评论