且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

垂直滚动条未显示

更新时间:2023-01-14 08:50:40

在给出答案之前,我会说我在编写 CSS 代码时告诉自己的最重要的事情是:如果我开始不得不 hack 那么我也在努力复杂.

Before giving an answer, I will say that the most important thing I tell myself when coding CSS is: if I start having to hack then I am making it too complicated.

话虽如此,首先删除代码中 overflow: hidden; 的每个实例.

With that said, start by removing every instance of overflow: hidden; in your code.

然后把它放在那里:

.top-nav {
    height: 70px; /* you already specify this on your site */
}
.scroll {
    position: absolute;
    top: 70px;
    bottom: 0px;
    left: 0px;
    right: 0px;
    overflow-y: scroll;
}