我正在重做朋友的website。 菜單在全寬時看起來很好,但當您爲響應而調整大小時,菜單看起來很透明並覆蓋了內容。我怎樣才能解決這個問題?我也有一個小提琴在這裏,我提出https://jsfiddle.net/mlegg10/co62auy0/響應菜單顯示behing內容
#menuBackground {
background:#5EA5B9;
width:100%;
height:50px;
text-align: center;
}
#menuContainer {
text-align: center;
}
/*Strip the ul of padding and list styling*/
ul {
list-style-type:none;
margin:0;
padding:0;
}
/*Create a horizontal list with spacing*/
li {
display:inline-block;
vertical-align: top;
margin-right:1px;
}
/*Style for menu links*/
li a {
display:block;
min-width:140px;
height:50px;
text-align:center;
line-height:50px;
font-family:Georgia;
color:#fff;
background:#5EA5B9;
text-decoration:none;
font-size: 1rem;
}
/*Hover state for top level links*/
li:hover a {
color: #036;
background:#fff
}
/*Prevent text wrapping*/
li ul li a {
width:auto;
min-width:100px;
padding:0 20px
}
/*Style 'show menu' label button and hide it by default*/
.show-menu {
font-family:Georgia;
text-decoration:none;
color:#fff;
background:#5EA5B9;
text-align:center;
padding:16px 0;
display:none;
width:100%!important
}
/*Hide checkbox*/
input[type=checkbox] {
display:none
}
/*Show menu when invisible checkbox is checked*/
input[type=checkbox]:checked ~ #menu {
display:block;
margin:0 auto
}
/*Responsive Styles*/
@media screen and (max-width : 760px) {
/*Make dropdown links appear inline*/
ul {
position:static;
display:none;
white-space: initial;
}
/*Create vertical spacing*/
li {
margin-bottom:1px
}
/*Make all menu links full width*/
ul li,li a {
width:100%
}
/*Display 'show menu' link*/
.show-menu {
display:block
}
}
<div id="menuBackground">
<div id="menuContainer">
<label for="show-menu" class="show-menu">Show Menu</label> <input type="checkbox" id="show-menu" role="button" />
<ul id="menu">
<li><a href="index.html">Home</a>
</li>
<li><a href="accommodations.html">Accommodations</a>
</li>
<li><a href="amenities.html">Amenities</a>
</li>
<li><a href="rates.html">Rates</a>
</li>
<li><a href="links.html">Links</a>
</li>
<li><a href="contact.html">Contact</a>
</li>
</ul>
</div>
</div>
它不是與菜單,它與內容的問題的問題。更新你的問題,以顯示內容的CSS和HTML,最有可能的Z - 索引問題 –