2012-08-13 65 views
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,但它被切断。CSS有从div边缘伸出的图像

我也必须在每行代码的字体中放4个空格,这非常慢!

回答

1

你的形象正在CUTT断,因为您使用的是你的父母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; 
} 
溢出