为固定/'sticky' 菜单调整网站的整个上部区域

Adjust whole upper area of website for fixed/'sticky' menu

我想通过 CSS.

请求帮助以功能方式修复 Wordpress 菜单(又名 'sticky')

这是我正在做的 the site

我已经 部分 使用 CSS 代码设置 #site-navigationposition: fixed 来解决这个问题。问题是效果很差,向下滚动时可以看到菜单的后方、上方和右侧的页面内容。我需要将菜单周围网站的整个上部区域变成一个固定的不透明对象,这样后面的内容就无法看到或点击。

非常感谢您的指点

.main-navigation {
    position: fixed;
    padding-top: 0;
    padding-bottom: 5px;
    z-index: 99999;
    background: #fff;
    top: 0;
    width: 68.571428571rem;
    margin-top: 0;
}

使用固定元素,您可以设置 top, left, right, bottom 值。 z-index 值将根据优先级使您的元素向前或向后。