I have been working on my inaugural website for educational purposes and encountered the following issue:
Every time I try to link to a specific section on the same page, it opens as intended but the top portion is obscured by the navbar.
<body data-spy="scroll" data-target="#myNavbar" data-offset="50">
<nav id="myNavbar" role="navigation" class="container-fluid navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand"></a>
</div>
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#section1">Home</a></li>
<li><a href="#section2">About</a></li>
<li><a href="#section3">Portfolio</a></li>
<li><a href="#section4">Contact</a></li>
</ul>
</div>
</div>
</nav>
<div class="jumbotron" id="section1">
<h1 class="header"></h1>
<hr class="style" />
<un class="list-inline">
<li>
<a href="#">
<span class="glyphicon glyphicon-chevron-left"></span> Facebook
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</li>
<li>
<a href="#">
<span class="glyphicon glyphicon-chevron-left"></span> GitHub
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</li>
<li>
<a href="#">
<span class="glyphicon glyphicon-chevron-left"></span> LinkedIn
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</li>
</un>
</div>
</body>
Is there any way to ensure that the linked section appears below the navbar so that it does not cover the top of the section?
I attempted adjusting the body's padding-top, but it did not work.
(I previously resolved this by linking to separate divs and adjusting them with CSS. However, after implementing Bootstrap scrollspy, I had to target full sections in order for the problem to resurface.)
P.S.: No JavaScript or jQuery was utilized.