我已將我的頁面分爲三部分:左側,中間和右側。應該出現在中心的元素在class="center"
之下,那些出現在右邊的元素在class="right"
之下。但由於某些原因,當我運行這段代碼頁面didvision with css
<div id="center">
<div>Hello world </div>
<div><label>Name</label> <input type="text" name="fnam" class="fields" id="fn" /></div>
</div>
輸出出來爲:
Hello
world
Name
field(text input)
每當有以下元素在下一行顯示單元之間的間隔。它對class =「right」也是一樣。爲.center
和.right
CSS代碼:
#right{
position : absolute;
right:500px;
margin-top :-75px;
width : 160px;
padding : 3px;
}
#center {
margin-top:10px;
width: 130px;
margin-left: 500px;
}
很高興看到您的所有代碼 - 至少是左邊,中間,右邊的CSS和一個小小的HTML(是否有包裝?是使用position:relative?的包裝)。現在我只能猜測問題是什麼。 – Dawson 2011-04-01 05:45:15