2014-09-01 70 views
0

我試着將這個地球圖片放在確切的位置,但是當頁面不是全屏時,出於某種原因,地球圖片消失了。我應該做些什麼改變,以確保屏幕不是全屏時,圖像保持在同一位置?圖片需要在相同的位置

div.image { 
    content:url(../images/logonew.png); 

    position: absolute; 
    left: 11.4%; 
    top:1%; 
    width: 77px; 
    height: 69px; 
    z-index: -1; 
    repeat:no-repeat; 
} 
+0

給演示鏈接或作出的jsfiddle – 2014-09-01 08:24:29

+1

'repeat'不是CSS有效樣式,即時通訊假設你意味着'背景重複'。我還假設你的意思是'背景圖像'而不是'內容'? – haxxxton 2014-09-01 08:26:45

+0

@haxxxton是的,這是真的 – 2014-09-01 08:28:55

回答

0

你的z-index:-1可能是問題的一部分,在網頁上默認的z-index最多的事:0,並可以覆蓋在一個z-index的圖像:-1。

無論如何,這對我的作品很好,我個人覺得事情是這樣的:

<div style="position:relative"> <!--relative to preceding stuff on web page --> 
<img style="position:absolute" /> <!--absolute with respect to inside the <div> block --> 
<img style="position:absolute" /> <!--obviously you need to specify more style data than shown here! --> 
<!--as many more images as you like, organized to precise locations inside the <div> block--> 
<!--other elements can also be precisely positioned in the <div> block; things like <p> and <span> 
    and <input> and <select> and <table> tags can have style data --> 
</div> 
<br /> 
<br /> 
<!-- use as many line-breaks as needed to reserve enough page-space for the stuff in the <div> block --> 
<br /> 
<br /> 
<!-- the rest of the web page now begins --> 
+0

謝謝!這解決了這個問題 – 2014-09-01 10:07:10