简体   繁体   English

修复了 header 与移动内容的下拉菜单

[英]Fixed header with dropdown menu which moves the content

Here's what happens when unfixed and it's the behaviour I want but I want navbar to be fixed这是未修复时会发生的情况,这是我想要的行为,但我希望修复导航栏在此处输入图像描述

Here's what happens when fixed: it doesn't move the content (it is behind this dropdown)修复后会发生以下情况:它不会移动内容(它位于此下拉列表的后面) 在此处输入图像描述

// scss for the nav
.filterbar {
    position: fixed;
    top: 0;
    box-shadow: 0 0 15px black;
    width: 100%;
// for info section
.filters-info {
    margin-top: 110px;
    display: flex;
    justify-content: space-between;
}

How to fix this?如何解决这个问题? (margin-bottom didn't help). (margin-bottom 没有帮助)。 I have two ideas: 1. to get toggleFilterbar prop and to change the styling based on this 2. to make the nav position absolute and then to change it to fixed.我有两个想法: 1. 获取 toggleFilterbar 道具并基于此更改样式 2. 使导航 position 绝对,然后将其更改为固定。 However, I guess there must be a simplier css way to fix this但是,我想必须有一个更简单的 css 方法来解决这个问题

Give position:relative;position:relative; to .filters-info.filters-info

and

Replace margin-top: 110px;替换margin-top: 110px; to top: 110px;top: 110px;

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

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