簡體   English   中英

CSS:滑塊與移動設備上的下拉菜單重疊-Z索引問題?

[英]CSS: Slider overlaps Drop down Menu on Mobile - Z-Index issue?

更新: 手機菜單問題圖片

我敢肯定,對於高級成員來說,這將很容易解決。 我用'nav'元素創建了下拉菜單。 出於某種我想嘗試的原因,當您在移動設備上展開菜單時,菜單無法覆蓋其下方的滑塊圖像。 我嘗試降低滑塊上的Z-index並在菜單上提高它。 我究竟做錯了什么? 提前致謝:

更新:這是包含HTML的注釋所要求的小提琴鏈接。 https://jsfiddle.net/wknow6cv/#&togetherjs=ADxkd31O6q

@import 'https://fonts.googleapis.com/css?family=Alegreya+Sans';

* {
margin: 0;
padding: 0;
border: 0;
overflow-x: hidden;
}

html,body
{
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;

}

body {
background: #F5F5F5;
color: #67727A;
font-family: 'Alegreya', Sans-serrif;
margin: 0;
}


h3 {
font-size: 150%;
line-height: 155%;
padding: 5% 0;
font-weight: 400;
}

p{
font-size: 120%;
line-height: 150%;
padding: 3%;
text-indent: 2%;
text-align: center;

}

img{
max-width: 100%;
height: auto;
width: auto;
margin-bottom: -4px;
}

header{
background-color: #6991AC;
width: 100%;
height: 120px;


}

h1{
position:absolute;
right: 600px;
top:30px;

}


#top-left-menu {


right: 0px;
}
#logo{
margin: 20px;
float: left;
width: 380px;
height: 60px;
background: url(img/RD.png) no-repeat center;
left: 0px;
top: 0px;


}

p {
font-size: 1.4vw;
}

h3{
font-size: 1.5vw;
}
/*--- Start Navigation --*/

nav{
float: right;
padding: 25px 20px 0 0; /*--top right bottom left--*/
}

#menu-icon{
display: hidden;
width: 40px;
height: 40px;
background: url(img/nav.png) center;
}

a:hover#menu-icon {
border-radius: 4px 4px 0 0;
}

ul{
list-style-type: none;
}

nav ul li {
font-family: 'Alegreya Sans', Sans-serrif;
font-size: 150%;
display: inline-block; 

/*makes the links go left from right instead of     up and down*/
float: left;
padding: 10px;

} 

nav ul li a {
text-decoration: none;
color: #F5F5F5;
}
nav ul li a:hover {
color: #C3D7DF;
}
/*.current{
color: #C3D7DF;
}

/*--End Navigation--*/


.one-fourth {
width: 25%;
float: left;
text-align: center;
font-family: Arial;
color: #F0F0F0;

} 

#cloud {
background-color: #C3D7DF;

}

#lock {
background-color: #6991AC;
}

#headset {
background-color: #C3D7DF;
}

#truck {
background-color: #6991AC;
}

.one-fourth i {             /*--Icons at one fourth blocks--*/
color: #F0F0F0;
font-size: 410%;
padding: 13% 0 4% 0;


}


article {
float: left;
margin: 0 auto;
width: 50%;
height: auto;

}

#sec-1 {
background-color: #FFFFFF;
}

aside {
float: right;
margin: 0 auto;
width: 50%;
height: auto;
}


.one-third {
width: 33.3333333%;
float: left;
text-align: center;
color: #FFFFFF

}

#google{
background-color: #A2B1C1;
}

#marketing {
background-color: #BEB9AD;  

}

#customers {
background-color: #AADCD2;

}



/*--Start Footer--*/

footer {
background-color: #4682B4;
width: 100%;

}

.social {
list-style-type: none;
text-align: center;

}

.social li {

display: inline;

}

.social i { /*--icons--*/
font-size: 220%;
padding: 3% 3% 3% 2%;
color: #C3D7DF;
}
.social i:hover {
color: F5F5F5;
}

footer.second { /*--Socket--*/
border-top: 1px solid #AADCD2;
background-color: #544B59;
max-height: 55px;
text-align: center;
margin: 0;

}

footer.second p {
padding: 5px 0 9px 0;
text-align: center;
}

.carouselbox {
font-family: helvetica,sans-serif;
font-size: 14px;
width: 100px;
position: relative;
margin: 1em;  
border: 1px solid #ccc;
box-shadow: 2px 2px 10px #ccc;
overflow: hidden;
}

.content {
margin: 0;
padding: 0;
}

.content li {
font-size: 100px;
margin: 0;
padding: 0;
width: 100%;
list-style: none;
text-align: center;
}

.new-inner {
height: 800px;
width: 100%;
float: left;
background-color: #FFFAFA;
font-family: Arial;
}

.nip1 {
width: 40%;
}
/*---------Insert Slideshow stuff below------*/

        .cycle-slideshow{
            width: 100%;
            display: block;
            position: relative;
            margin: 0 auto;
            overflow: hidden;

        }

        .cycle-prev, .cycle-next {
            font-size: 200%;
            color: #FFF;
            top: 50%;
            display: block;
            position: absolute;
            z-index: 9999;
            cursor: pointer;
        }

        .cycle-prev {left: 10%;}
        .cycle-next {right: 10%}
        .cycle-pager{
            width: 100%;
            text-align: center;
            display: block;
            position: absolute;
            bottom: 20px;
            z-index: 9999;
            cursor: pointer;

        }

        .cycle-pager span {
            text-indent: 100%;
            white-space: normal;
            width: 12px;
            height: 12px;
            display: inline-block;
            border: 1px solid #FFF;
            border-radius: 50%;
            margin: 0 10px;


        }

        .cycle-pager .cycle-pager-active {background: #FFF;}





/*------------MEDIA QUERIES ARE NOW STARTING-------------*/

@media screen and (max-width: 768px){




p {
    font-size: 250%;
}


h3{
    font-size: 260%;
}
header{

    width: 100%;

}

#logo {
    margin: 15px 0 20 -25px;
    background: url(img/RD_mobile.png) no-repeat center;
    float: left;
    width: 170px;
    height: 60px;

}
#menu-icon {
    display: inline-block;
}
nav ul, nav:active ul {
    display: none;
    z-index: 1000;
    position: absolute;
    padding: 20px;
    background: #6991AC;
    right: 20px;
    top: 60px;
    border: 1px solid #FFF;
    border-radius: 2px 0 2px 2px;
    width: 50%;
}
nav:hover ul {
    display: block;
}

nav li {
    text-align: center;
    width: 100%;
    padding: 10px 0;
}


.one-fourth {
    float: left;
    width: 100%;
    font-size: 30%;
}

.one-fourth i {
    font-size: 500%;
    padding: 4% 0 1% 0;
}



article {
    width: 100%;
}

aside {
    width: 100%;
}

.hand-mobile {
    display: none;

}


.social i {
    font-size: 100%;
}




}

也許嘗試將媒體查詢導航更改為position: relative;

編輯:改為嘗試此操作,更改display: none內聯:

nav ul, nav:active ul {
    display: inline;
    z-index: 1000;
    position: relative;
    padding: 20px;
    background: #6991AC;
    right: 20px;
    top: 60px;
    border: 1px solid #FFF;
    border-radius: 2px 0 2px 2px;
    width: 50%;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM