Skip to main content

Responsive Navigation Menu Bar using only HTML & CSS

Responsive Navigation Menu Bar using only HTML & CSS

Responsive navigation menu bar plays an important role for every website. The navigation menu bar creates user satisfaction with the beauty of the website. The user needs a responsive navbar so that he can easily find the topic of his choice.

 I have designed many more types of menubars before. But in that case, I used JavaScript code to execute the menu button. I have not used any JavaScript or external JavaScript library for this design. I have created this Responsive Navigation menu bar using pure CSS and HTML code. I only used CSS code to make it responsive. I have made it responsive using only the @media function of CSS code.

Here I have basically used a logo and used five menu items. I have used the hover effect on the menu links. The background color will change when you click on those items or move the mouse.

Video Tutorial of Responsive Navigation Menu Bar

You can watch the video tutorial below to know how it works and how to make it.


How To Create a Responsive Navbar with HTML CSS

If you have learned how to create a navbar from the video above, you can download the necessary source codes. If you are a beginner, follow the tutorial below. In the following tutorial, I have shown you how to make it with a complete step-by-step image.

Step 1: Create navbar background

First of all, I designed the background of this navigation bar. Here the height: 80px and width: 100% of the background is used. I used black color in the background. You can use any other color if you want.

<nav>
 <!--menu button -->

 <!--logo -->

 <!-- Menu item -->

</nav>



*{
  padding: 0;
  margin: 0;
  text-decoration: none;
  list-style: none;
  box-sizing: border-box;
}
body{
  font-family: sans-serif;
}
nav{
  background: #000000;
  height: 80px;
  width: 100%;
}

Create navbar background

Step 2: Add a logo to the menu bar

Here I have created a logo with the help of text. In this case, you can use any image. However, I have easily created the logo using the text here. font-size: 33px has been used to make a slightly larger size. The text color I have used is white so that it can be clearly seen on a black background.


<label class="logo">Coding Home</label>


label.logo{
  color: white;
  font-size: 33px;
  line-height: 80px;
  padding: 0 20px;
  font-weight: bold;
}

Add a logo to the menu bar

Step 3: Create menu items as needed

Now I have added menu items using HTML code. Here I have used five menu items. You can increase or decrease the amount if you want. I have used the font-size: 17px and color white of the menu links.

<ul>
  <li><a href="#">Home</a></li>
  <li><a href="#">About Me</a></li>
  <li><a href="#">Blog</a></li>
  <li><a href="#">Contact</a></li>
  <li><a href="#">Portfolio</a></li>
</ul>


nav ul{
  float: right;
  margin-right: 10px;
}
nav ul li{
  display: inline-block;
  line-height: 80px;
  margin: 0 5px;
}
nav ul li a{
  color: white;
  font-size: 17px;
  padding: 15px 15px;
  border-radius: 3px;
  font-weight: 520;
  text-transform: uppercase;
}
a:hover{
  background: #414345;
  transition: .8s;
 
}

Create menu items as needed

Step 4: Create menu buttons for responsive devices

Now I will create a menu button for the Responsive device. As you can see above, all the menu items are hidden in the case of Responsive Devices. A menu button is available instead. When you click on that menu button, you will see all the menu items. 

This button was originally created using icons. I have used font-size: 30px and the color white to increase the size of that icon. I used float: right to keep it to the left. Here we have used display: none which will help to hide this button in general. Because it will be effective only in the case of responsive devices.


<input type="checkbox" id="check">
 <label for="check" class="checkbtn">
    <i class="fas fa-bars"></i>
 </label>


.checkbtn{
  font-size: 30px;
  color: white;
  float: right;
  line-height: 80px;
  margin-right: 40px;
  cursor: pointer;
  display: none;
}
#check{
  display: none;
}

Create menu buttons for responsive devices

Step 5: Make the navigation bar responsive with css

Using @media I made it suitable for Responsive Devices. Max-width: 935px is used here, which means that the following codes will be applied to devices with a screen size of less than 935px. 

Here display: block is used for checkboxes. As a result, we will see this menu button for devices below screen size 935 px.


@media (max-width: 935px){
  label.logo{
    font-size: 30px;
    padding-left: 50px;
  }
 
 
  .checkbtn{
    display: block;
  }
  ul{
    background: #1d1d1d;
    top: 80px;
    left: -100%;
    position: fixed;
    width: 100%;
    height: 100vh;
    text-align: center;
    transition: all .5s;
  }
  nav ul li{
    padding: 15px 15px;
    line-height: 20px;
    display: block;
    margin: 20px 0;   
  }
  nav ul li:hover{
      background-color: rgb(48, 49, 51);
  }
  nav ul li a{
    font-size: 20px;
  }
  a:hover{
    background: none;
    color: #0082e6;
  }
  #check:checked ~ ul{
    left: 0;
  }
}

Make the navigation bar responsive with css

You can watch the video tutorial above to know more. I have created many more types of navigation menus before. 

Below is the download button with the help of which you can download the source code for this project. If there is a problem or the download button does not work, you can comment.





Comments

Popular Posts

Animated Progress Bar using Only HTML and CSS

Animated progress bar is mainly used in various business and personal web sites. css progress bar helps to organize your knowledge in a beautiful way. In this article, I am going to show you how to create an animated progress bar using only HTML and CSS code. I have made many other types of Progress Bar before but in that case, I have used JavaScript.  I have not used any JavaScript or external JavaScript library for this design. I created this Animated Progress Bar design using Pure HTML and CSS code. Skill bars are used on various websites to streamline the amount of experience, education, etc. with the help of animations. First of all, I have given the background-color: # 30336b of a web page. Then I made a small box here. I used four CSS Progress Bar in that box. The value of this bar will be zero when opening the page then gradually it will reach the pre-determined meaning. Video Tutorial of Pure CSS Progress Bar If you want to know how to make it better then you...

Neumorphism login form UI Design using HTML and CSS

In this article, I will show you how to create a Neumorphism login form UI design . We all know that the login form plays an important role in any website. Basically, we face the login form to access the account on different websites. Where we can log in to our account with a username and password.  Neumorphism is currently a very popular UI trend that is being used extensively to create a variety of web elements. This type of design is more beautiful than ordinary design and it is much easier to make.  This Neumorphism login form I created only with HTML and CSS code. Here is the complete color of the background color and the color of the web element. Basically, in this type of design, the background color of the web page and the element is completely the same. However, in this case, some shadows are created using CSS code which determines the size of these elements.  I put everything here like a normal login form . First of all, I added a title then there is no pla...

Automatic Image Slider using Only HTML & CSS

In this article, I am going to show you how to create an automatic image slider using only HTML and CSS code. We know that an image slider is a simple web element that is used to organize different images of the website in one place.  There are different types of image sliders and the most automatic image slider is used. This type of slider is mainly used in the hero section of the homepage of various websites. In addition, different types of services or portfolio websites are used to decorate the images of many types of projects.  Basically, this type of design has no navigation buttons which means there is no way to change the image manually. The images here will continue to change automatically from time to time. You can set this time in advance.  First of all, I set the background of a web page to black. Then I arranged all the images nicely there. In this case, I did not use any JavaScript code . It was created using effects in the animation of css3. ...

3D Image Slideshow using Only HTML and CSS

3D Image Slideshow is a type of image gallery that is currently used on a variety of websites. It helps to keep many types of images neatly arranged together. This not only enhances the beauty of the website but also user satisfaction.  I have already created many types of image sliders and image galleries but it is a little different. Basically, we use JQuery or JavaScript to change the image in other designs. However, I did not use any JavaScript in this case. In this case, I made it using only HTML and css3 . Yeah Al that sounds pretty crap to me, Looks like css3 just got used to the modern animation effect .  In this case, no button was created to change the image. It tends to change from time to time by itself. This means that it is an automatic 3d image slider built with HTML and CSS code only. This 3D image slider is like a square box. At certain intervals, this box rotates from right to left. I have used four images around this box. When the box is rotated, e...