giovanni
giovanni

Reputation: 1

Have div go under a position fixed nav

I am currently trying to fix an issue where when I make any divs under my nav it goes to the top left of the page. If I put a padding-bottom on the nav it fixes the issue, but I'm trying to make the page responsive and not have to play around with padding numbers.

https://codepen.io/gmorabito/pen/JjMMdOj

nav{
    position: fixed;
    top: 40px;
    width: 95%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-height: 8vh;   
    z-index: 9999;
    border: 1px solid black;
    border-radius: 10px;
    margin-left:2.5%;
    z-index: 1;
}

Upvotes: 0

Views: 28

Answers (1)

DCR
DCR

Reputation: 15698

make the nav position:static and add 25px to margin-top. Absolute positioning should be avoided as much as possible. It takes the element out of the flow of the dom and makes responsive websites much more difficult

Upvotes: 1

Related Questions