2014-09-22 82 views
0

我有這樣的啓動畫面。啓動屏幕與CSS高度100%不工作

HTML

<div id="spalsh"> 
    <span> <img src="{% static 'dbexplorer/img/loading.gif' %}" style="height: 100px;" > </span> 
</div> 

CSS

#spalsh{ 
    width: 98%; 
    height: 100%; 
    background: rgba(252, 252, 252, 0.67); 
    z-index: 10000; 
    position: absolute; 
    margin: 0px; 
    padding: 0px; 
} 
#spalsh span{ 
    position: absolute; 
    width: 100%; 
    text-align: center; 
    top: 60px; 
} 

如果頁面高度增加動態再閃屏不能覆蓋全高。我想覆蓋頁面的整個高度。有沒有JS的PURE CSS的解決方案?

添加圖像: splash

+0

爲什麼不嘗試添加身高:100%的範圍呢? – 2014-09-22 08:01:17

+0

您應該將圖像高度設爲100%。 參見此處[http://stackoverflow.com/questions/18164227/using-css-to-make-image-size-100-to-height-of-container][1] [1 ]:http://stackoverflow.com/questions/18164227/using-css-to-make-image-size-100-to-height-of-container – Developer 2014-09-22 08:02:43

+0

試過,沒有成功.. :) – 2014-09-22 08:02:54

回答

0

如果我理解正確的話,你想的屏幕覆蓋開機畫面?

嘗試給出div spalsh(不應該是splash?)背景覆蓋的背景。

.spalsh { 
    background: url(images/bg.jpg) no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
} 

Tutorial

這應該與瀏覽器spalsh背景圖像調整。

而且,我真的會重命名爲splash

+0

對不起,我的命名..;) 我的圖像是非常小的加載gif。您的解決方案使其成爲全高GIF。即使在使用您的解決方案之後,它仍未覆蓋整頁高度。 – 2014-09-22 08:15:09

+0

你可以設置一個JSfiddle或將它放在某個地方,以便我們可以使用你的代碼? – Rvervuurt 2014-09-22 08:29:32

+0

試試這js小提琴http://jsfiddle.net/5eh1fh61/9/ – 2014-09-22 10:08:50