美文网首页
关于伪类的特性

关于伪类的特性

作者: tonarinototoro | 来源:发表于2018-08-04 11:37 被阅读0次

    清除浮动时用到的伪类: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