html - 溢出:在我的响应式菜单上滚动不起作用。该怎么办?

标签 html css responsive-design overflow

我的响应式菜单的 overflow: scroll; 属性不起作用。我不明白是哪个属性/特性阻止了它的应用。

以下是 header 的响应式 CSS 属性:

header .menu_icon{
    display: block;
}

ul.social{
    display: none;
}

header nav{
    display: block;
    background: #353434;
    margin: 21px 0 0 0;
    padding: 0;
    border-left: 0;
    border-top: 1px #2c2c2c solid;
    text-align: center;
    position: relative;
    z-index: 9999;
    display: none;
    overflow: scroll;
}
header nav{
    border-bottom-left-radius: 2px;
    -webkit-border-bottom-left-radius: 2px;
    -moz-border-bottom-left-radius: 2px;
    -o-border-bottom-left-radius: 2px;
    border-bottom-right-radius: 2px;
    -webkit-border-bottom-right-radius: 2px;
    -moz-border-bottom-right-radius: 2px;
    -o-border-bottom-right-radius: 2px;


}
header nav.show_menu{
    display: block;

}
header nav ul li{
    margin: 0;
    width: 100%;
    border-bottom: 1px #2c2c2c solid;

}
header nav ul li:last-child{
    border-bottom: 0;
}
header nav ul li a{
    display: block;
    width: 100%;
    padding: 20px 0;
}
header nav ul li a:active{
    display: block;
    width: 100%;
    padding: 20px 0;
    background: #2c2c2c;
}

我正在 header nav 中添加 overflow: scroll;。即使我已经尝试为每个元素添加此属性。还是不行。

这是我的响应式网站的屏幕截图: enter image description here

最佳答案

添加:
overflow-y: scroll !important; 并设置 max-height: 100px !important;

关于html - 溢出:在我的响应式菜单上滚动不起作用。该怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50226206/

相关文章:

html - CSS 导航栏在页面中间居中

javascript - 如何在文本和表格之间切换?

javascript - 表格不断调整大小而不溢出

jquery - 数据表搜索、排序不起作用

image - 响应式站点图像问题

html - 媒体查询改变自己?

javascript - 如何使用 javascript 中的坐标突出显示字符串中的单词?

css - chrome 和 safari 上的 z-index 问题(firefox 没问题)

mobile - 有多少移动浏览器支持 CSS 媒体查询?

javascript - 使div与文本在同一行,放在哪里显示:inline-block?