去浮动问题被搞了好久网上查了感觉好乱,为什么下面的代码clearfix不能去浮动,有没有大佬解释一下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>lianxi</title>
<style>
*{
margin: 0;
padding: 0;
}
html,body{
height: 100%;
}
.clearfix :after {
content: '';
display: table;
clear: both
}
/* .clearfix:after {
content:"\200B";
display:block;
height:0;
clear:both;
}
.clearfix{*zoom:1;}/*IE/7/6*/*/
.div1{
width: 50px;
height: 50px;
background: red;
float: left;
}
.div2{
width: 200px;
height: 50px;
background: blue;
}
</style>
</head>
<body>
<div class="clearfix">
<div class="div1">16</div>
<!-- <p style="clear: both;"></p> -->
<div class="div2">20</div>
</div>
</body>
<script>
</script>
</html>
你把
/*
和/*IE/7/6*/*/
去掉就好了。。。细心、格式、、、、