2015-07-13 111 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; 
}