Anker bei Fixed Navbar treffen nicht

Sep 27
2017

If you’re using a .navbar-fixed-top fixed to top navbar in Twitter Bootstrap you probably have noticed your anchor ahref links no longer line up correctly.

The easiset way to fix this is to the use the <section id="MyAnchor"> tag with a padding-top equal to the padding you’ve added to the body.

So for example if you have:

.body {
padding-top:40px
}

You will then want to add the same padding to your section CSS:

section {
padding-top:40px;
}

If the 40px gap above each section is going to mess with your design mojo you can add a negative margin-bottom. So for example:

section {
padding-top:40px;
margin-top:-40px;
}

 

Quellenangabe: https://www.servermule.com.au/help/bootstrap-anchors-fixed-nav/

Leave a Reply

You must be logged in to post a comment.

Optimization WordPress Plugins & Solutions by W3 EDGE