2015-07-13 54 views
0

我該如何更改CSS代碼,使徽標(#logo)在左上角出現在所有其他div上?較高的Z-index值不會改變位置:/例如,當您單擊「沙龍」並滾動時,圖片和文本將滾動到徽標上方,而不是下方。如何在內容上放置徽標? (Z-Index被忽略)

這裏的鏈接: http://hosting2022.esy.es/

/* HEADER WITH LOGO */ 

header {   
    width:100%; 
    position: fixed; 
    top: 0px; 
    z-index:2000; 
    height: 80px; 
} 

#header-wrapper { 
    width: 1280px; 
    margin: 0 auto; 
    z-index:9999; 
    height:80px; 
    line-height:80px; 
    position:relative;  
} 

#logo { 
    margin:20px 0; 
    height:40px; 
    width:auto; 
    float:left; 
} 

/* MAIN DIV WITH MENU AND CONTENT-DIV*/ 

#mainx { 
    padding: 0 0 0 0 !important; 
margin: 0 !important; 
border: 0 !important; 
    position: fixed; 
    z-index: 11000; 
} 

/* THE MENU DIV */ 

#menuxx { 
    line-height:50%; 
    z-index:21000; 
    top:35px; 
    right:105px; 
    width:450px; 
    height:70px; 
    position:fixed; 
    } 

/*CONTENT DIV -> Should be placed under the logo and menu*/ 

#Salon { 
top:0; 
margin-left: auto; 
margin-right: auto; 
width: 100%; 
height:100%; 
position:fixed; 
overflow:hidden; 
} 
+2

請添加代碼在你的問題 –

+0

你的意思是說可以你請解釋一下。? –

+0

我希望代碼片段有所幫助。該網站的標誌應始終位於所有div的頂部。 – Martin

回答

0

只需添加到您的樣式(降低對.mainx的z-index),因爲你分配

.mainx { 
    z-index: 2500; 
} 

您當前的解決方案是行不通的:

#logo { 
    z-index: 3000; 
} 

and

.mainx { 
    z-index: 11000; 
} 
+0

但不幸的是,之後菜單不可點擊。你能告訴我,我必須改變什麼? – Martin

+0

在.menuxx上添加z-index:3000 – Keammoort

+0

@Martin,有幫助嗎? – Keammoort

0

的的的z-index被應用到您的#logo元素,因爲它被認爲要麼相對固定絕對位置的位置將無法正常工作。

+0

好吧,爲什麼它仍然沒有改變,當我添加「位置:相對」例如徽標div? – Martin

+0

某些其他元素的_z-index_可能比_logo_更高,因此您的徽標仍然保留在其他元素的下方。 –

0

樣式添加到您的<header>標籤

<header style="z-index: 100;"> 

這是怎麼照顧..

enter image description here

+0

不幸的是,當我這樣做時,菜單不再可點擊:/ – Martin

1

添加這個CSS到你的風格

#content { 
    position: relative; 
    z-index: 100; 
}