Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.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定位绝对图像不';你不来吗?_Css - Fatal编程技术网

为什么CSS定位绝对图像不';你不来吗?

为什么CSS定位绝对图像不';你不来吗?,css,Css,我的主容器具有相对位置,我想将两个图像叠加在一起 当我将绝对位置添加到我的一个div时,它就消失了 我试图使用定位左上右等我附加的图像如何它应该看起来 这是我的密码 <div style="position: relative;"> <div style="background: url('http://i.imgsafe.org/8797eaa.png') no-repeat; background-size: 100% auto; height: 709px;

我的主容器具有相对位置,我想将两个图像叠加在一起

当我将绝对位置添加到我的一个div时,它就消失了

我试图使用定位左上右等我附加的图像如何它应该看起来

这是我的密码

  <div style="position: relative;">
    <div style="background: url('http://i.imgsafe.org/8797eaa.png') no-repeat; background-size: 100% auto; height: 709px;margin-top: 70px"></div>
    <div style="background: url('http://i.imgsafe.org/8ab6260.png') no-repeat; background-size: 100% auto; height: 170px;position: absolute; top:0; left: 0"></div>
  </div>

有什么建议吗

使用

width:100%
因为拥有绝对位置的图像绝对可以解决您的问题;)

这是你的免费小提琴^^


您忘了指定绝对div的宽度。在css中添加
宽度:100%