How To Create A Simple Navigation Bar Using Only HTML and CSS?


STEP 1:

Add a ul tag and inside it add li tag. Inside li tag add a tag with the Name.

HTML Code

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <div class="header"><h1>SmartTechTip</h1></div>
<ul>
  <li><a href="">Home</a></li>
  <li><a href="">HTML</a></li>
  <li><a href="">CSS</a></li>
  <li><a href="">JS</a></li>
  <li><a href="">About</a></li>
</ul>
</div>
</body>
</html>


STEP 2:

Add this CSS Code.
*{
    margin:0;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}
.header{
    height: 200px;
    background-color: rgb(43, 43, 43);

}
h1{
    text-align: center;
    position: relative;
    top: 80px;
    font-size: 50px;
    color:white;
}
ul{
    list-style-type: none;
    margin:0;
    padding: 20px;
    background-color: black;
}
li{
    display:inline;

}
li a{
    text-decoration: none;
    padding: 20px 20px;
color:rgb(255, 255, 255);
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}
a:hover{
    background-color: rgb(255, 255, 255);
    color:black;

}


Output




Trending Posts

Is Web Development a Good Career?

Easy Light Bulb Project: HTML, CSS, and JavaScript

How Long Does It Take to Learn Programming?

How to Become a Web Designer: A Complete Guide

How To Create a Fake Facebook Login Clone Using Only HTML and CSS?

Brief History Of Computer

60hz vs 90hz vs 120hz | Which One is Best? | What is Refresh Rate?

Is HTML a Programming Language?

How To Create A Magic 8 Ball Using HTML, CSS, and JavaScript?

Is Blogging Dead? Exploring the Relevance of Blogging in 2025