2014-02-05 72 views
1

我在玩弄HTML & CSS,並試圖製作一個非常簡單的「under contruction」頁面。我將背景設爲黑色,文字爲白色。我將文本放在了我想要的位置,而不是試圖在文本下方插入圖像。我把圖片加入了網站,但不知怎的,它在我的背景之後?任何人知道該怎麼做?重疊插入圖像的背景圖像

繼承人我CSS代碼:

.fullscreenDiv { 
    background-color: #000000; 
    width: 100%; 
    height: auto; 
    bottom: 0px; 
    top: 0px; 
    left: 0; 
    position: absolute; 
    background-attachment:fixed; 
} 
.center { 
    position: absolute; 
    width: 100px; 
    height: 50px; 
    top: 50%; 
    left: 50%; 
    margin-top: -75px; 
    margin-left: -190px; 
    white-space: nowrap; 
    font-family: Century Gothic; 
    font-size: 120%; 
    color: #FFFFFF; 
} 
.trademark { 
    position: absolute; 
    width: 100px; 
    height: 50px; 
    top: 50%; 
    left: 50%; 
    margin-top: 250px; 
    margin-left: 400px; 
    white-space: nowrap; 
    font-family: Century Gothic 
    font-size: 80%; 
    color: #FFFFFF; 
} 

而我的HTML:

<div class='fullscreenDiv'> 
    <div class="center">Our website is currently under construction.</div> 
</div> 

<div class='fullScreenDiv'> 
    <div class="trademark">@GameAdviser - Copyright 2014</div> 
</div> 

編輯: 只是一個快速的,現在的問題,我做了它的工作把我的照片,並將其上傳到我的FTP ,現在當我進入網站時,我看不到我的照片,只是與「圖像不易」圖像或任何其他圖像的邊界。看起來很奇怪,因爲我有一張照片,之前工作得很好。

試圖將其從png更改爲jpeg,但沒有什麼區別。

+0

有一個在你的代碼 – SaturnsEye

+0

沒有像你爲什麼不使用身體作爲'fullscreenDiv'? – artur99

回答

0

可以使用的z-index像

z-index:199; // for the Element you want on top 
z-index:-199; // for the Element you want at bottom 
+0

立即工作,謝謝! – KrownScripter

+0

嘿嘿嘿兄弟然後接受我的回答我回答名譽:) – ArmaGeddON

0

z-index屬性添加到.center和更改類名fullscreenDiv而不是fullScreenDiv區分大小寫。

試試這個代碼:

DEMO

.center { 
    position: absolute; 
    width: 60%; 
    height: 50px; 
    top: 50%; 
    left: 20%; 
    font-family: Century Gothic; 
    font-size: 120%; 
    color: #FFFFFF; 
    z-index: 10; 
    text-align: center; 
} 
+0

更新了我的帖子.. – Manoj