我看教程里清除浮動標準寫法是.clearfloat:after{display:block;clear:both;content:"";visibility:hidden;height:0}?
.clearfloat{zoom:1}但是為什么我這個只是寫#box:after{content:"";clear:both;display:block;}這么寫也能清除浮動,那么visibility和height屬性為什么也要寫?附上代碼:<!DOCTYPE?html>
<html?lang="en">
<head>
????<meta?charset="UTF-8">
<style>
#box{}
.son{width:100px;height:100px;float:left;}
#green{background:green;}
#red{background:red;}
#blue{background:blue;}
#black{background:black;}
#box:after{content:"";clear:both;display:block;}
#box{*zoom:1}
</style>
</head>
<body>
<div?id="box">
????<div?id="green"?class="son"></div>
????<div?id="red"?class="son"></div>
????<div?id="blue"?class="son"></div>
</div>
</body>
</html>
添加回答
舉報
0/150
提交
取消