我的頁面如下所示。
風格:CSS中心的div並排排列
.featuredcontainer {
width: 450px;
height: 700px;
margin-left: auto;
margin-right: auto;
position: relative;
right: 160px;
top: 30px;
border: 1px groove grey;
}
.navcontainer
{
margin-left: auto;
margin-right: -8px;
position: relative;
top: 75px;
height: 600px;
width: 300px;
}
而例如HTML:
<div class="featuredcontainer">
content
</div>
<div class="lessonnavcontainer">
menu
</div>
當顯示的頁面。 navcontainer在右側(正如它應該),但在featuredcontainer下。當我使用相對定位將navcontainer向上移動時,它看起來很正確,但頁面底部有一堆空的空間。我該怎麼辦?
嘗試在兩個類中添加'float:left' – 2012-07-09 18:03:18
現在它們彼此相鄰,但不會隨頁面大小調整並位於混亂的位置。 – Jaxkr 2012-07-09 18:04:56
刪除所有'頂部'和'右',並適合父div內的那兩個div