1

我在相对容器中有一个绝对定位的图像。我想使用负边距,但它正在剪裁我的图像。

这是我的 HTML 代码:

<div id="container" class="clearfix">
  <div class="left-col">
     /*CONTENT*/
  </div><!-- /.left-col -->
    <div id="my-image"><img src="images.png" height="596" width="392" alt=""></div><!-- /#image -->
</div><!-- /#container -->

这是我的CSS:

#container{
position: relative;
background-color: orange;
    width:600px;
    height:600px;
}

#my-image{
background-color: blue;
position: absolute;
z-index: 1150;
bottom:0;
right:-130px;
width:398px;
height:596px;
}

结果如下:

在此处输入图像描述

负底有效,但负左右无效。我已经简化了代码并为东西加上了通用名称。

感谢您的意见!

4

0 回答 0