2017-05-17 33 views
0

我目前正在建設一個網站,真的很喜歡我的「4位置」下拉菜單工作。但導航菜單與其重疊。我最初的想法是,我們Z-index將它堆疊在主導航之上,但它不起作用。我能做什麼??查看它:去http://pcfm.adamerica.me/Z-索引不工作,使div包含下拉菜單重疊導航

這是CSS:

/* Dropdown Button */ 
.location-dropbtn { 
    background-color: #4CAF50; 
    color: white; 
    padding: 10px; 
    font-size: 12px; 
    border: none; 
    cursor: pointer; 
} 

/* Dropdown button on hover & focus */ 
.location-dropbtn:hover, .location-dropbtn:focus { 
    background-color: #3e8e41; 
} 

/* The container div - needed to position the dropdown content */ 
.location-dropdown { 
    position: absolute; 
    display: inline-block; 
    margin-top: -10px; 
    margin-left: 20px; 
    margin-right: 20px; 
    z-index: 110001; 
} 

/* Dropdown Content (Hidden by Default) */ 
.location-dropdown-content { 
    display: none; 
    position: absolute; 
    background-color: #4CAF50; 
    color: #ffffff; 
    min-width: 160px; 
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); 
    z-index: 110001; 
} 

/* Links inside the dropdown */ 
.location-dropdown-content a { 
    color: #ffffff; 
    font-size: 12px; 
    padding: 12px 16px; 
    text-decoration: none; 
    display: block; 
    z-index: 110001; 
} 

/* Change color of dropdown links on hover */ 
.location-dropdown-content a:hover { 
    background-color: #3e8e49 
} 

/* Show the dropdown menu */ 
.show { 
    display:block; 
    z-index: 110001; 
} 

回答

0

這將工作

header { 
    z-index: 1000; 
} 
0

你.location-下拉.show具有的z-index:110001.
你.responsive頭類有z-index:100000(這是方式正常工作在媒體小於980px)

在大於980px的媒體:

您的標頭class =「header2 sticky」的z-index:100000000.這是問題所在,將此標頭z-index更改爲110000,它將正常工作。