One issue I'm facing involves my navbar and how it interacts with links to content containers. Whenever I click on a link that scrolls the website to a container, the text ends up disappearing under the navbar. View the demo screenshots below for clarity:
Unexpected Outcome:
Desired Result:
In this scenario, the link directs to the container labeled as "Content 1". Is there a method to adjust the navbar so that it doesn't scroll down too far, remaining higher up on the page to ensure better visibility of the "Content 1" heading? I am utilizing Bootstrap 5.
Sample Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="70121f1f04030402110030455e405e42">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<header class="sticky-top">
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#content">Link</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container mt-5 mb-5" id="firstContent">
<div class="row">
<div class="col-md-6">
<h2>First Title</h2>
<ul>
<li>Some text and follow this <a href="readme.html">Link</a> along</li>
<li>Then read the code at Github</li>
</ul>
<hr>
</div>
<div class="col-md-6">
<h2>Second Title</h2>
<ul>
<li>Some text and follow this <a href="readme.html">Link<\/a>along</li>
<li>Then read the code at Github</li>
</ul>
<hr>
</div>
</div>
</div>
... (additional container sections)
</body>
</html>