我的第一个流体网格布局有问题。在大多数浏览器中,这种布局看起来是移位(可变宽度)。它只适用于 Firefox。(不适用于 chrome 或 opera) 我不明白为什么。
谢谢
<!DOCTYPE html>
<html>
<head>
<title>Grid Test</title>
<style type="text/css">
.col {
float:left;
background-color: grey;
margin-left: 1%;
margin-right: 1%;
margin-top: 1px;
margin-bottom: 1px;
height: 50px;
text-align: center;
}
.one_quater {
width: 23%;
}
.two_quater {
width: 48%;
}
.three_quater {
width: 73%;
}
.one_thirds {
width: 31.333%;
}
.two_thirds {
width: 64.666%;
}
.one_half{
width: 48%;
}
.one_full{
width: 98%;
}
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
</style>
</head>
<body>
<div class="row">
<div class="col one_full">
1/1
</div>
</div>
<div class="clear"></div>
<div class="row">
<div class="col one_thirds">
1/3
</div>
<div class="col one_thirds">
1/3
</div>
<div class="col one_thirds">
1/3
</div>
<div class="clear"></div>
</div>
<div class="row">
<div class="col two_thirds">
2/3
</div>
<div class="col one_thirds">
1/3
</div>
<div class="clear"></div>
</div>
<div class="row">
<div class="col one_thirds">
1/3
</div>
<div class="col two_thirds">
2/3
</div>
<div class="clear"></div>
</div>
<div class="row">
<div class="col one_half">
1/2
</div>
<div class="col one_half">
1/2
</div>
<div class="clear"></div>
</div>
<div class="row">
<div class="col one_quater">
1/4
</div>
<div class="col one_quater">
1/4
</div>
<div class="col one_quater">
1/4
</div>
<div class="col one_quater">
1/4
</div>
<div class="clear"></div>
</div>
<div class="row">
<div class="col two_quater">
2/4
</div>
<div class="col one_quater">
1/4
</div>
<div class="col one_quater">
1/4
</div>
<div class="clear"></div>
</div>
<div class="row">
<div class="col one_quater">
1/4
</div>
<div class="col two_quater">
2/4
</div>
<div class="col one_quater">
1/4
</div>
<div class="clear"></div>
</div>
<div class="row">
<div class="col one_quater">
1/4
</div>
<div class="col one_quater">
1/4
</div>
<div class="col one_quater">
1/4
</div>
<div class="col one_quater">
1/4
</div>
<div class="clear"></div>
</div>
<div class="row">
<div class="col one_quater">
1/4
</div>
<div class="col three_quater">
3/4
</div>
<div class="clear"></div>
</div>
</body>
</html>