您的位置:首页 > Web前端 > CSS

css 伪元素 伪类 使用 万能清除浮动 ..

2016-12-20 03:24 771 查看
参考 http://blog.jobbole.com/49173/

css 伪元素即插入的虚伪元素 像:before :after 插入元素

css 伪类 就是 操作class 样式

利用伪元素清除浮动

ps 利用伪 元素插入的dom 在dom结构中是看不到的 不过可以在css 中看到

.clearfix::after {
content: ".";
clear: both;
display: block;
overflow: hidden;
font-size: 0;
height: 0;
}



.clearfix {
zoom: 1;
}


利用伪元素插入 图片

blockquote:before {
content: " ";
font-size: 24pt;
text-align: center;
line-height: 42px;
color: #fff;
float: left;
position: relative;
top: 30px;
border-radius: 25px;

background: url(images/quotationmark.png) -3px -3px #ddd;

display: block;
height: 25px;
width: 25px;
}
blockquote:after {
content: " ";
font-size: 24pt;
text-align: center;
line-height: 42px;
color: #fff;
float: right;
position: relative;
bottom: 40px;
border-radius: 25px;

background: url(images/quotationmark.png) -1px -32px #ddd;

display: block;
height: 25px;
width: 25px;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: