Navbar fixed on the top of HTML page (CSS / HTML)

前端 未结 5 1458
心在旅途
心在旅途 2020-12-18 13:37

I\'m trying to learn some of CSS3 and HTML5 but I\'m a little confused with somethings. For now, I want create a page with a fixed navbar on the top of page, that scrolls wi

5条回答
  •  轮回少年
    2020-12-18 14:16

    Add margin-top to your content. The header is fixed - so it is not included within the flow of the document.

    Also notice that you have opacity defined on your header - which causes you to slightly see the content when scrolling.

    If this is not what you wanted - then remove it. (like so)

    FIDDLE

    #content{
        margin-top: 100px;
        z-index: 0;
        position: absolute;
    }
    

提交回复
热议问题