html是:
<div id="container">
<div id="top-bar">Top Bar</div>
<div id="nav-bar">
<a>Blah 1</a>
<a>Blah 2</a>
<a>Blah 3</a>
</div>
<div id="main">
<div id="column-left">
column left
</div>
<div id="column-right">
column right
</div>
<div id="column-right-adsense">
column right adsense
</div>
<div class="spacer"></div>
</div>
<div id="footer">footer</div>
而CSS是:
#container {
/* width: 500px; */
border: 1px solid black;
}
#top-bar {
height:60px;
border: 1px solid red;
}
#column-left {
border: 1px solid blue;
width: 40%; /* 200 / 500 */
float: left;
}
#column-right {
border: 1px solid yellow;
width: 40%; /* 200 / 500 */
float: left;
}
#column-right-adsense {
border: 1px solid cyan;
width: 18%; /* 90 / 500 */
float: left;
}
.spacer {
clear:both;
}
正如你在这个小提琴上看到的那样,当你调整窗口的大小时,最后一列会向下跳。我怎样才能防止这种情况?