0
我正在爲我的新網站編寫代碼,但是當我製作兩個應該在彼此旁邊的div時,一個在另一個之下。我試過這樣的定位:你如何讓兩個div旁邊的eachother沒有使用定位?
position: absolute; top:20px; left:20px;
但在certian瀏覽器上一切都變得混亂起來。這裏是我的代碼,我正試圖在左邊'left'左邊'main'在它的右邊。
<div id="left" style="background-image:url(bg2.png); width: 326px; position: relative; z-index: -10;" ><img src="aldesign.png">
<br>
<img src="home.png" onmouseover="this.src='home2.png'" onmouseout="this.src='home.png'" />
<br>
<img src="about.png" onmouseover="this.src='about2.png'" onmouseout="this.src='about.png'" />
<br>
<img src="contact.png" onmouseover="this.src='contact2.png'"onmouseout="this.src='contact.png'" />
<br>
<br></div><div id="main" style="background-image:url('bg3.png'); background-repeat:repeat; width:924px; height: 522px; float: right;">
</div>
請儘快幫忙!謝謝:)
浮動它們兩個? –
divs自動佔據其容器的整個寬度,除非您將它們浮動並固定寬度。爲什麼不嘗試跨度這種事情呢? –
謝謝,我只需要左'左'和'主'右漂浮。它現在有效。 – OrangeJackk