2014-01-07 71 views
0

我有一個位置固定在頁面中的圖像。當我重新調整瀏覽器的大小時,圖像覆蓋了我的頁面內容,我該如何防止這種情況發生?當調整窗口大小時修復圖像位置

<div > 
    <img id="img1" class="wrapperImage"></img> 
</div> 

<style type="text/css"> 
    .wrapperImage 
    { 
    position : fixed; 
    width:200px; 
    height:100px 
    } 
    </style> 
+0

'位置:fixed'是概率,你就需要使用'設置正確的寬度float'財產(單位:%),因此,這種良好比對或調整.. –

回答

0

你必須設一箇中心DIV和它position:relative設置和設置您的圖像 position:absolute,在您的中央格,並與z-index你可以改變你要顯示元素的優先級,然後設置z-index:10爲您的圖像。

0

嘗試添加z-index:-1;到您的CSS。

0

你可以做到這一點,圖像將繼續留在,甚至當你調整窗口大小的相同位置,

通過給父標籤相對定位,和孩子點點絕對的立場不會改變,即使調整窗口大小

<div id="divname"> 
    <img id="img1" class="wrapperImage"></img> 
</div> 

<style type="text/css"> 
    .divname{ 
     position:relative; 
    } 

    .wrapperImage 
    { 
    position : absolute; 
    z-index:-1; //depending weather your image should appear 
         at the above or below div change it to +1 or -1 
    top: 100px; 
    right: 100px; 
    width:200px; 
    height:100px 
    } 
    </style> 
相關問題