Wednesday, June 19, 2024

NAVBAR

 

A vertical and a horizontal navbar (navigation bar) are components used in web design to help users navigate through different sections or pages of a website. Here’s an explanation of both, along with examples:

Vertical Navbar

  • A vertical navbar is a navigation bar that is positioned vertically along the side of the webpage. It typically appears on the left or right side of the page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vertical Navbar</title>
<style>
body {
font-family: Arial, sans-serif;
}
.vertical-navbar {
height: 100vh;
width: 200px;
background-color: #333;
display: flex;
flex-direction: column;
padding-top: 20px;
}
.vertical-navbar a {
padding: 15px;
text-decoration: none;
color: white;
text-align: center;
}
.vertical-navbar a:hover {
background-color: #575757;
}
</style>
</head>
<body>
<div class="vertical-navbar">
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</div>
</body>
</html>



Horizontal Navbar

  • A horizontal navbar is a navigation bar that is positioned horizontally across the top of the webpage. It typically appears at the top of the page, just below the header.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Horizontal Navbar</title>
<style>
body {
font-family: Arial, sans-serif;
}
.horizontal-navbar {
width: 100%;
background-color: #333;
overflow: hidden;
}
.horizontal-navbar a {
float: left;
display: block;
color: white;
text-align: center;
padding: 14px 20px;
text-decoration: none;
}
.horizontal-navbar a:hover {
background-color: #575757;
}
</style>
</head>
<body>
<div class="horizontal-navbar">
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</div>
</body>
</html>



No comments:

Post a Comment