首页 > Web开发 > 详细

css 双伪元素清除浮动

时间:2020-05-15 09:50:28      阅读:268      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>双伪元素清除浮动</title>

<style type="text/css">
/* 声明清除浮动的样式 */
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
/* ie6 7 专门清除浮动的样式*/
.clearfix {
*zoom:1;
}


.one {
width: 500px;
border: 1px solid red;
}

.damao {
float: left;
width: 200px;
height: 200px;
background-color: purple;
}
.ermao {
float: left;
width: 250px;
height: 250px;
background-color: skyblue;
}

.two {
width: 700px;
height: 150px;
background-color: #000;
}
</style>
</head>
<body>

<div class="one clearfix">
<div class="damao"></div>
<div class="ermao"></div>
</div>

<div class="two"></div>

</body>
</html>

css 双伪元素清除浮动

原文:https://www.cnblogs.com/ericblog1992/p/12893045.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!