Drop Down Menu with Sub Menu HTML & CSS

How to create a dropdown navigation bar in HTML CSS?
A: To create a responsive drop-down navigation bar with a submenu, I have provided essential codes article and video tutorial below:

Hello readers, today we will learn How to Create a Responsive Drop Down Menu with Sub Menu in HTML & CSS and a little touch of JavaScript. Earlier, I have created various blogs of Responsive Navigation Bar using HTML and CSS, but I haven't built any drop-down navigation menu bar.

What is Drop-Down Menu?
Simply, Drop down menu means that features on the navigation bar from the sub-menu come out while clicking or by doing hover on the parent navigation links. Submenu helps to reduce space on the navigation bar that makes it easier for users to explore the things that they want from the website.

How many links should be in your main navigation and sub-menu?
You can add nav links on your main navigation menu and sub-menu as need of your website and it also depends on the width of the navigation menu bar. Normally you can add 5 to 7 nav links on the main navigation bar and 3 to 5 on the drop-down sub-menu.

What is the element you have included on the drop-down navigation bar?
As you can see on the given image of the drop-down navigation menu with sub-menu. Basically, you can add the following elements that I have added to my drop-down menu. You can add the following elements to the navigation menu.
  • Your Logo
  • Navigation Links (5 to 7) normally
  • Sub-menu Links (3 to 5) normally
  • Social Media Icons.
  • Sidebar Open/Close Button (Responsive)

How do I create a dropdown navigation menu with a submenu?
There are various ways to create a drop-down navigation menu. I think the following are the best and easy ways:

Make <ul> </ul> tag as a parents for the main navigation links.
Inside the <ul> </ul> tag add <li> </li> tag like this <ul><li>Home</li></ul>
Now for submenu add  <ul> </ul> tag again inside the <li> </li> like this:
  <li>Sub Menu</li>

ul li{position: relative}; (to main parent li tag)
ul li ul{position: absolute
top: 0;
left: 100%;
display: none};

make it visible when we hover on the parent element by giving display: block  

For getting the virtual example of this responsive drop-down navigation menu with submenu and codes that I have used to build this type of navbar with submenu, I recommend you to watch the following video tutorial.

Drop Down Navigation Menu with Sub Menu | Video Tutorial

I hope, you like my navigation menu design. To create this navigation menu with the feature of drop-down sub-menu, I have used HTML5 CSS3 and a little touch of JavaScript. This is a fully responsive design. Responsive means this navigation can fit in any screen sizes devices like on big sizes computer, laptop, tablet or mobiles.

Those friends, who are feeling difficulty building responsive navbar menu with sub-menu. I have provided all source codes of the responsive drop-down menu with the sub-menu below. Rather you can copy the following coded or you can also download all files by clicking on the given download button.

You May Like This:

Drop Down Menu with Sub Menu | Source Code

Top copy-paste the following HTML CSS and JavaScript codes you need to create two files, one is HTML file and another is CSS files on your computer you can also download files directly by clicking on the given download button.

How do you create a dropdown in HTML?
Create an HTML file with the name index.html on your computer and copy-paste the following HTML codes on your HTML document.


How do you create a dropdown in CSS?
Create a CSS file with the name style.css on your computer and copy-paste the following CSS codes on your CSS document.


How do you create a dropdown in JavaScript?
Create a JS file with the name script.js on your computer and copy-paste the following JScodes on your JS document.


Click on the download button to directly download all source code files of Responsive Drop Down Menu with Sub Menu.

Post a Comment

We welcome relevant and respectful comments. Off-topic or spam comments may be removed.

Previous Post Next Post

AdBlock Detected!

Our website is made possible by displaying ads. Please whitelist our site to download source code files. Read more