2013-02-24 41 views
1

我有一個容器,裏面有一個圖像。 Jscrollpane應用在容器上,所以它的溢出隱藏起來。我想改變圖像的負邊距位置在容器外。但我不能因爲溢出:隱藏是活躍的。我將它更改爲overflow-x,但它不起作用。在具有溢出屬性的DIV內使用負邊距

在線查看:http://jsfiddle.net/e6444/1/

#container { 
    width:500px; 
    height:300px; 
    background:grey; 
    overflow-y:hidden; 
    margin:0 auto; 
} 

#image { 
    width:150px; 
    height:150px; 
    background:url("http://www.audiapproved.com/ImgThumb?id=16033-500-335"); 
    margin:0 0 0 -30px; 
} 

<div id="container"> 
    <div id="image"> 
     Text, text, text Text, text, text Text, text, text Text, text, text 
    </div> 
</div> 

我想以下幾點:http://jsfiddle.net/e6444/2/但overflow屬性。 (我需要它爲jscrollpane插件)

+1

那麼,什麼是你想要達到的結果呢? – Terry 2013-02-24 17:53:07

+0

你似乎沒有太多的選擇。刪除溢出或將圖像移動到容器外部。 – cimmanon 2013-02-24 17:56:00

+0

Mabye它只是我,但我沒有得到它,你想要什麼? – 2013-02-24 17:57:28

回答

1

您可以爲您的溢出添加另一個容器:隱藏的內容。

<div id="container"> 
    <div id="content"> 
     This is my content that can be overflow:hidden 
    </div> 
    <div id="image"> 
     Text, text, text Text, text, text Text, text, text Text, text, text 
    </div> 
</div> 

http://jsfiddle.net/wLrCU/1/