Answers for "navbar using div with html"

4

navbar with css

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Navbar</title>

<style>
body {
margin: 0;
}
.navbar{
padding: 15px;
background-color: grey;
display: flex;
justify-content: space-between;
font-size: 30px;
text-decoration: none;
color: #fff;
}
    .nav-item {
    margin: 0;
    padding: 0;
    flex: 1;
    max-width: 50%;
    display: flex;
    justify-content: space-evenly;
    font-size: 25px;
    }
    .nav-link {
    display: inline-block;
    }
    a{
    text-decoration: none;
    color: #fff;
    }

    @media (max-width: 715px) {
    .nav-item {
    flex-direction: column;
    align-items: center;
    }
    .nav-link {
    margin: 5px 0;
    }
    }
</style>


</head>
<body>
<nav class="navbar">
    <a class="brand" href="">Navebar</a>
    <ul class="nav-item">
        <li class="nav-link"><a href="">Learn more</a></li>
        <li class="nav-link"><a href="">About</a></li>
        <li class="nav-link"><a href="">Contact</a></li>
    </ul>
    <a class="home" href="">Home</a>
</nav>
</body>
</html>
Posted by: Guest on July-23-2021
0

how to make a navigation bar in html

<!-- HTML PART -->
<a class="active" href="#home">Home</a>
<a href="news.html">News</a>
<a href="contact.html">Contact</a><a href="about.html">About</a>


<!-- CSS PART -->

.topnav a {
    float: left;
    color: goldenrod;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 20px;
  }
  
  /* Change the color of links on hover */
  .topnav a:hover {
    background-color: rgb(221, 221, 221);
    color: black;
  }
  
  /* Add a color to the active/current link */
  .topnav a.active {
    background-color: red;
    color: goldenrod;
  }
Posted by: Guest on September-04-2021

Browse Popular Code Answers by Language