24/04/2014 by Nitesh

How to Create a Hierarchical Menu Using HTML And CSS


I am planning to write a series of articles on creating menus in different ways and this is the 1st one in the series. This post will explain how to create a simple 2 level menu using HTML and CSS only. We know there are a lot of ways to create a HTML menu but at  times, we need to use only HTML/CSS in the project to create a nice menu. So, lets get started.

We will create a HTML structure as below using <ul> and <li> tags. Write the below code in your HTML file where you want to place the menu.

Now, we have the structure ready. Definitely, the current menu does not look good and we will now apply some CSS to make it look beautiful. Write the below code in the <head> section.

Save the HTML file and double click on it to view on the browser. Your menu should look something like the below screesnhot.

You can read other parts of this series below –
How to Create a Hierarchical Menu Using HTML, CSS and jQuery
How to Create Single Level Menu Dynamically Using C# in ASP.Net

Hope you like this post! Cheers!