 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Create a sticky navbar with CSS
To create a sticky navbar, use the position: sticky; property. You can try to run the following code to create a sticky navbar,
Example
<!DOCTYPE html> <html>    <head>       <style>          ul {             list-style-type: none;             position: sticky;             overflow: hidden;             top: 0;             width: 100%;          }          li {             float: left;             border-right: 1px solid white;          }          li a {             display: block;             padding: 8px;             background-color: orange;          }          li:last-child {             border-right: none;          }          div {             padding:5px;             margin-top:5px;             background-color:white;             height:1000px;          }       </style>    </head>    <body>       <ul>          <li><a href = "#home">Home</a></li>          <li><a href = "#news">News</a></li>          <li><a href = "#contact">Contact</a></li>          <li><a href = "#about">About</a></li>       </ul>       <div>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>       </div>    </body> </html>Advertisements
 