Responsive Top Navigation Menu with HTML and CSS
This tutorial will help you to know how to create a Responsive Top Navigation Menu bar. The navigation menu is an important element for any website. We see Responsive Top Navbar on different websites. Which helps to keep the various important links of the website beautifully arranged.
If you are a beginner and want to know how to create a menu on top navigation then this tutorial will help you a lot. Here I have only used HTML, CSS, and very little JavaScript.
We see side menubars, full-page menubars, and stick menubars on different websites. However, the navbar is the most used.
Responsive Top Navigation Menu
It is very simple and is made up of only a few links and a logo. However, the bar on this CSS has been made fully responsive. This allows you to use it directly on any website or project.
In this tutorial, you will find the necessary information, source code, and video tutorial. No dropdown was used in this design. If you want to add a dropdown to this navigation bar you can see the other designs I made.
As you can see above, this is simple navigation created by HTML and CSS. First, the basic structure of the bar has been created. Its height is 70 px and its width is 100%. I used blue color in the background. You can use another color if you want.
First, a logo was used. I used text to create this logo. You can use the image here if you want. Then I used five menu items. Different hover effects have been added to each item.
How To Create a Top Navigation Bar
In the case of responsive devices, these menu items are completely hidden. A menu button can be found instead. When you click on that button, all the menu items can be seen below.
I have used 4 line javascript to execute this menu button. Now is the time to create this Responsive Top Navigation Menu. For this, you need to have some idea about HTML and CSS. The rest I will try to explain to you in this tutorial.
1. Basic structure of navbar
The basic structure of this navigation bar has been created using the following HTML and CSS codes. This navbar uses width: 100%, height: 70px and background color blue.
This number is used top: 0 to keep it at the top and position: fixed to keep it fixed in a certain place.
2. Add logo in the navigation
I have created a logo using the code below. I added text to create the logo. Font-size: 26px and its color white has been used to increase the size of the text.
3. Add menu item in Top Navigation
Now I have added the menu items. Here I have used five menu items. Padding: 0 15px is used to keep distance between each item and font-size: 19px is used to increase the text size a bit.
The links below are designed with the help of CSS. I used text-decoration: none to hide the underline between these links, and the color was white.
4. Menu Button for Responsive Devices
Now the menu button has been created. I have used font-size: 20px to increase the width: 80px, height: 40px and text size of this button. Has used display: none here so this button cannot be seen under normal conditions.
5. Make the menu bar responsive using CSS
Made the navigation bar fully responsive using the following codes. It is very important to be responsive in a navigation bar. I have made it a response by using some amount of CSS here. The following codes will work when you open this CSS top navigation using a small device like mobile.
First I used display: block to make the button visible. I used display: none as you can see above. For which the button was hidden. Now using display: block the button will be seen in the case of a responsive device.
With each menu item is designed. Display: none is used in the menu item here. As a result, menu items cannot be found here.
6. Activate the Menu button with JavaScript
Now, this menu button has been implemented using some amount of JavaScript. First, the constants of the two HTML functions are determined. Because we can't use any HTML element directly in JavaScript.
Below I have indicated that when you click on that menu button "show" will be added to the menu items. I have already added the value of "show" to CSS.
Clicking on the menu button will add that ".show {display: block;" to the menu item so that the menu items can be seen.
Hopefully from this tutorial, you have learned how to create this Responsive Navigation menu bar using HTML and CSS.
Earlier I shared with you the tutorials of different types of top navigation bars. Be sure to comment on how you like this simple and responsive top navbar.
Comments
Post a Comment
Tell me what you think ??😎