简体   繁体   English

响应式网站菜单Z-索引

[英]Responsive website menu z-index

i'm trying to build a responsive menu. 我正在尝试建立一个响应式菜单。 I'm having some problems with adding the correct Z-indexes. 添加正确的Z索引时遇到一些问题。

Here is the website: http://erlendvanlandeghem.be/ When you make your window smaller, you should get a button that says "show menu". 这是网站: http : //erlendvanlandeghem.be/当您缩小窗口时,您应该得到一个显示“显示菜单”的按钮。 The menu then expands behind the content (cwrap). 然后,菜单在内容后面展开(cwrap)。 I've tried fixing it with z-indexes, but that doesn't seem to work. 我曾尝试用z-indexes修复它,但这似乎不起作用。

Any help? 有什么帮助吗? Thanks in advance! 提前致谢!

just add position:relative; 只需添加position:relative; to the following id #navwrapper 到以下ID #navwrapper

Add this code main.css at 302 number line. 在302数字行处添加此代码main.css。

@media only screen and (max-width: 480px)
#navwrapper {
   width: 100%;
   left: -1px;
   text-align: center;
   background-color: transparent;
   max-width: 480px;
   position: relative;
   z-index: 10;
}

Add z-index to #navwrapper and it will work 将z-index添加到#navwrapper即可使用

#navwrapper {
  width: 240px;
  left: -1px;
  background-color: #333333;
  height: 100%;
  position: fixed;
  float: left;
  text-align: left;
  box-shadow: 1px 0px 3px #888888;
  z-index: 999;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM