Nav bar overlapping page content!

0

Hello, I have a page with a menu (nav bar) and when I click on a menu link the page should point to the corresponding session , for example, when I click on the envelope I have a session session is with a hidden part behind the menu, ie the height of the menu is not respected as in the following image / p>

What'swithablueoutlineisthesession,noticehowitgoesuptherebehindthemenu.

HTMLCSS

nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f5f5f5;
    position: fixed;
    top:0;
    width: 100%;

}
nav a img{
    display: flex;
    text-align: center;
    flex-direction: column;
    width: 200px;
    padding: 0;

}

nav > a{
    text-decoration: none;
    color: azure;
    font-weight: 700;
    font-size: 28px;
    font-family: serif
}

nav ul{
    list-style: none;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
nav ul li{
    text-align: center;
    width: 100%;
    font-weight: bold;
    font-size: 20px
}
nav ul li a {
    display: inline-block;
    padding: 10px 0;
    width: 100%;
    text-decoration: none;
    color: darkblue;

}
 <nav>
    <a href="#top"><img src="imagens/Logo%20DMDUQUE%20Final.png"></a>
    <ul>
        <li><a href="#sobre">Sobre</a></li>
        <li><a href="#servicos">Serviços</a></li>
        <li><a href="#contato">Contato</a></li>                
    </ul>
</nav>
    
asked by anonymous 26.07.2016 / 19:24

1 answer

2

What is happening is that since your <nav> element is with position: fixed it does not "take up space" on the page, so the content below starts at the top, below the <nav> .

Places a padding-top: 15px (Being 15px only a sample value, you can change depending on the code) in your content that the upper bar will stop overlapping.

    
27.07.2016 / 19:00