Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 我的img元素赢了';t与其父项重叠';她是家长吗?_Css_Html_Positioning - Fatal编程技术网

Css 我的img元素赢了';t与其父项重叠';她是家长吗?

Css 我的img元素赢了';t与其父项重叠';她是家长吗?,css,html,positioning,Css,Html,Positioning,我的网站设置如下: <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="contentLeft

我的网站设置如下:

<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>
似乎发生的情况是,由于父“container”div的宽度限制,图像被截断,但它成功地与“contentainer”div重叠。我做错了什么?我正试图将
car.png
粘贴到页面的前面


感谢高级版。

问题不是宽度限制,而是溢出:隐藏#容器样式中的code>。根据定义,这意味着任何扩展到
#容器
之外的内容都会被切断。

您的doctype声明在哪里?始终先添加此项,以防止常见问题。
我只是忽略了它,因为我认为它没有什么区别。非常感谢!我想我不久前在刷新CSS内存时添加了它以使元素居中,但是
margin:0 auto在没有它的情况下更正它。再次感谢。
#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;
}