Create a simple and effective navigation bar using HTML. This guide shows how to build a navigation menu that links to different pages on your website.
Step 1: Create an HTML file
Create a new file and name it navbar.html
.
Step 2: Add the basic HTML structure
Set up the basic structure like below.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Navigation Bar</title> </head> <body> <!-- Content will go here --> </body> </html>
Step 3: Create the Navigation Bar
Inside the <body>
tag, create a navigation bar using an unordered list (<ul>
) and list items (<li>
).
<body> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="about.html">About</a></li> <li><a href="services.html">Services</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </body>
Final Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Navigation Bar</title> </head> <body> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="about.html">About</a></li> <li><a href="services.html">Services</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </body> </html>