Edit This Code:
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../lib/w3.css">
<body>

<div class="w3-top">
  <ul class="w3-navbar w3-red w3-large">
    <li><a href="tryit.asp-filename=tryw3css_navbar_fixed_top.html#">Home</a></li>
    <li><a href="tryit.asp-filename=tryw3css_navbar_fixed_top.html#">Link 1</a></li>
    <li><a href="tryit.asp-filename=tryw3css_navbar_fixed_top.html#">Link 2</a></li>
  </ul>
</div>
<br><br>

<div class="w3-container">
  <h2>Fixed Top Navigation</h2>
  <h3>The w3-top class forces the navigation bar to stay at the top of the page, even when the user scrolls the page.</h3>
  <h3>Scroll this page to see the effect.</h3>
  <p>Some text to enable scrolling..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
  <p>Some text some text some text some text..</p>
</div>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy