Answers for "top navigation bar html"

28

html navigation bar

<!-- How to create a navigation bar:
 This is the html file:

 Put the class="active" in the html file/page you are coding in
 (e.g. put the class="active" in the Home.html file)
 To position a page link to the right do class="right"
-->
<body>
<ul class="topnav">
  <li><a class="active" href="Home.html">Home</a></li>
  <li><a href="Page1.html">Page1</a></li>
  <li><a href="Page2.html">Page2</a></li>
  <li class="right" ><a href="About.html">About</a></li>
</ul>
</body>

<!-- This is the css file:
 (have a play with the colours and features!)-->
ul.topnav {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #333;
  font-family: arial;
  text-align: left;
  width: 100%;
  position: sticky;
  top: 0;
}
ul.topnav li {float: left;}
ul.topnav li a {
  display: block;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  float: left;
  font-size: 17px;
  border-right: 1px solid #bbb;
}
ul.topnav li a:hover:not(.active) {
	background-color: #ddd;
    color: black;
}
ul.topnav li a.active {
	background-color: #4CAF50;
}
ul.topnav li.right {
	float: right;
}
@media screen and (max-width: 720px) {
  ul.topnav li{
	  width: 100%;
  }
  ul.topnav a{
	  width: 100%;
  }
}
<!-- END -->
Posted by: Guest on October-17-2020
5

html navigation bar

<!--Method 1: Using HTML5 Nav Tag-->
<nav>
	Thing1 |
  	Thing2 |
  	Thing3
</nav>

<!--Method 2: HTML5 + CSS3 with DIV element-->

<ul class="topnav">
  <li><a class="active" href="#">Thing 1</a></li>
  <li><a href="#">Page 1</a></li>
  <li><a href="#">Page 2</a></li>
  <li class="right" ><a href="#">Thing 2</a></li>
</ul>
<style>
	
  ul.topnav {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
    font-family: arial;
    text-align: left;
    width: 100%;
    position: sticky;
    top: 0;
  }
  ul.topnav li {float: left;}
  ul.topnav li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    float: left;
    font-size: 17px;
    border-right: 1px solid #bbb;
  }
  ul.topnav li a:hover:not(.active) {
      background-color: #ddd;
      color: black;
  }
  ul.topnav li a.active {
      background-color: #4CAF50;
  }
  ul.topnav li.right {
      float: right;
  }
  @media screen and (max-width: 720px) {
    ul.topnav li{
        width: 100%;
    }
    ul.topnav a{
        width: 100%;
    }
  }
</style>
Posted by: Guest on January-03-2021
0

top navbar css

/* This is the css for the nav bar*/

nav{

    display: flex;
    align-items: center;
    position: sticky;
    top: 0px;
    align-items: center;
    min-height: 8vh;
    
}

nav::before{
    content: "";
    background-color: rgb(255, 255, 255);
    position: absolute;
    top:0px;
    left:0px;
    height: 100%;
    width:100%;
    z-index: -1;
    opacity: 0.4;
}


#logo{
    color:rgb(0, 0, 0);
    text-transform: uppercase;
    letter-spacing: 5px;
    margin-left: 20px;
    margin-right: 60px;
    font-size: 22px;
}

.nav-links{
    display: flex;
    justify-content: space-around;
    width: 18%;
}
.nav-links li{
    list-style: none;
    display: inline-block;
    
}

#N1{
    margin-left: 20px;
    margin-right: 10px;
}
#N2{
    padding-left: 5px;
}

.nav-links a{
    color:rgb(0, 0, 0);
    font-size: 20px;
     text-decoration: none;  
     letter-spacing: 3px; 
    font-weight: bold;
    width: 150px;
    display: inline-block;
    text-align: center;
       
}

.cool-link::after{
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: rgb(0, 0, 0);
    transition: width .3s;
}
.cool-link:hover::after{
    width:100%;
    transition:width .3s;
}
/* designing of the buttons */
.btn{
    border: 1px solid #3498db;
    background: none;
    padding: 10px 20px;
    font-size: 25px;
    font-family: "montserrat";
    cursor: pointer;
    margin: 10px;
    transition: 0.8s;
    position: relative;
    overflow: hidden;
    text-decoration: none;
  }
  .btn::before{
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 0%;
    background: #3498db;
    z-index: -1;
    transition: 0.8s;
   
  }
  .btn a{
    text-decoration: none;
    color:#fff;
    
  }
  .btn4{
    color: #fff;
    
  }
  
  .btn4:hover{
     color:black ;   /*  change the color*/
  }
  
  
  .btn4::before{
    bottom: 0;
    border-radius: 50% 50% 0 0;
  }
  .btn4::before{
    height: 180%;
  }
  
  .btn4:hover::before{
    height: 0%;
  }


/* button ends */

.burger{
    position: absolute;
    right: 30px;
    cursor: pointer;
    display: none;
}
.burger div{
    width: 25px;
    height: 3px;
    background-color: rgb(5, 5, 5);
    margin: 5px;
}


/* Nav bar in the mobile version*/

@media screen and (max-width: 670px)
{
     body{
        overflow-x: hidden;
    } 
    
    .nav-links{
        position: absolute;
        right: 0px;
        height: 25vh;
        top: 8vh;
        background-color: rgb(241, 241, 241);
        
        
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 50%;
        transform: translateX(100%);
        transition: transform 0.3s ease-in;
       /* canging the z index of the */

    }

    .nav-links a{
        color:rgb(0, 0, 0);
        font-size: 20px;
         text-decoration: none;  
         letter-spacing: 3px; 
        font-weight: bold;
       
        display: inline-block;
        width: 150px;
        text-align: center;
        margin-left: 50px; 
    }
    
    .nav-active{
        transform: translateX(0%);
    }
    .burger{
        display: block;
    }
  
}
Posted by: Guest on April-18-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
0

Top navigation bar

<div class="topnav">
  <a class="active" href="#home">Home</a>
  <a href="#news">News</a>
  <a href="#contact">Contact</a>
  <a href="#about">About</a>
</div>
Posted by: Guest on May-15-2021

Code answers related to "top navigation bar html"

Browse Popular Code Answers by Language