twitter bootstrap navbar fixed top overlapping site

后端 未结 18 1745
甜味超标
甜味超标 2020-11-22 11:59

I am using bootstrap on my site and am having issues with the navbar fixed top. When I am just using the regular navbar, everything is fine. However, when i try to switch it

18条回答
  •  无人及你
    2020-11-22 12:31

    Your answer is right in the docs:

    Body padding required

    The fixed navbar will overlay your other content, unless you add padding to the top of the . Try out your own values or use our snippet below. Tip: By default, the navbar is 50px high.

    body { padding-top: 70px; }
    

    Make sure to include this after the core Bootstrap CSS.

    and in the Bootstrap 4 docs...

    Fixed navbars use position: fixed, meaning they’re pulled from the normal flow of the DOM and may require custom CSS (e.g., padding-top on the ) to prevent overlap with other elements.

提交回复
热议问题