0
#col{
width:200px; 
float:left;
overflow:visible;
position:relative;
z-index:2;
}

<div id="col">

<img style="margin-left:-6px; z-index:999; position:relative;"  src="img.jpg" />
</div>

画像を6px左に突き出させたいのですが、切り取られています。

また、コードのすべての行のフォントに4つのスペースを入れる必要がありますか?これは非常に遅いです!

4

2 に答える 2

1

親でオーバーフローを使用しているため、画像が切り取られていますdiv#col

<div id="col">
  <img src="img.jpg" alt="some info">
</div>

CSS

#col{
width:200px; 
float:left;
position:relative;
/*overflow: visible;*// remove
/*z-index:2;*// no need to do that
}
#col img {
position: absolute;
top: 0;
left: -6px;
width: width of image in px;
height: height of image in px;
}
于 2012-08-13T14:54:03.943 に答える
0

これはあなたが探しているものですか?

http://jsfiddle.net/qPhba/

于 2012-08-13T14:46:05.603 に答える