主要内容隐藏了响应式菜单

时间:2019-08-27 14:12:49

标签: css

我已经将此简单的水平菜单集成到了Web应用程序的所有页面中。

https://jsfiddle.net/3u6m4b1w/

全屏打开页面时,一切正常(请参见图片):

enter image description here

但是当我切换到响应式(参见图2)时,我遇到了一个奇怪的问题:

黄色的警报框越来越高,菜单隐藏在主要内容后面!

我已经尝试使用z-index之类的

.nav-list-pagina { z-index:9999; }

但什么都没发生。

enter image description here

我想要获得的是这个(由photoshop编辑):

enter image description here

任何人都可以帮助我找到正确的CSS吗?

使用最后一个查询更新字段

2 个答案:

答案 0 :(得分:1)

我想您可以将clear: both; CSS属性添加到.alert类中:

.alert {
    position: relative;
    padding: .75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: .25rem;
    clear: both;
}

enter image description here

答案 1 :(得分:1)

尝试此代码,应该可以重叠使用。

.nav-list-pagina {
    z-index: 2;
    position: relative;
}