How to Create Navigation Bar using CSS

How to Create a Navigation Bar using CSS

We will guide you on How to Create a Navigation Bar using CSS.

nav.html

<html>
<head>
<title>Navigation Bar</title>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<ul>
  <li><a class="active" 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>
</body>
</html>

style.css

ul {
   list-style-type: none;
   margin: 0;
   padding: 0;
   overflow: hidden;
   background-color: #333;
 position: fixed;
  top: 0;
  width: 100%; 
 }
li {
   float: left;
 } 
li a {
   display: green;
   color: white;
   text-align: center;
   padding: 14px 16px;
   text-decoration: none;
 } 
li a:hover:not(.active) {
   background-color: #111;
 } 
.active {
   background-color: #4CAF50;
 } 

You can read on Facebook

Leave A Reply