0
我的網站是建立這樣的:我的img元素不會重疊其父母的父div?
<html lang="en">
<body>
<div id="container">
<div id="contentainer">
<img src="img/car.png" alt="car.png" syle="position: absolute; top:10px; left:-35px; ">
<div id="contentLeftTop"> ... </div>
<div id="contentRightTop"> ... </div>
<div id="contentLeftBottom"> ... </div>
</div>
</div>
</body>
</html>
而這依賴於所涉及的元素的CSS:什麼似乎發生
#container {
position:relative;
margin:auto;
width:820px;
overflow:hidden;
z-index:-1;
}
#contentainer {
position:relative;
float:left;
width:800px;
background-color:#FFF;
border:10px groove #999;
border-radius:15px;
z-index:1;
}
是圖像得到切斷,由於寬度父容器div的限制,但它成功地覆蓋了「contentainer」div。我究竟做錯了什麼?我試圖將car.png
貼在頁面的前面。
謝謝先進。
你的文檔類型聲明在哪裏?總是首先添加這個來防止常見問題。 – enyce12
'<!DOCTYPE html>'我只是省略了它,認爲它沒有什麼區別。 – mattshu