Bootstrap css hides portion of container below navbar navbar-fixed-top

后端 未结 7 1356
傲寒
傲寒 2020-12-22 20:35

I am building a project with Bootstrap and im facing little issue .I have a container below the Nav-top.My issue is that some portion of my container is hidden below the nav

7条回答
  •  悲哀的现实
    2020-12-22 21:24

    It happens because with navbar-fixed-top class the navbar gets the position:fixed. This in turns take the navbar out of the document flow leaving the body to take up the space behind the navbar.

    You need to apply padding-top or margin-top to your container, based on your requirements with values >= 50px. (or play around with different values)

    The basic bootstrap navbar takes height around 40px. So if you give a padding-top or margin-top of 50px or more, you will always have that breathing space between your container and the navbar.

提交回复
热议问题