Drop Down Menu

Drop Down Menu

This tutorial will show you the process of making a fall down list purely HTML and CSS. The creation process engages the following 3 very simple steps:
The Steps
conclude on the structure
Mark up and method="color: Red;">method with sub menus shown
Make sure the sub-menus rightly display up on rollover
Let's look into each step in minutia:
conclude on the structure
How do you desire it to look? A good beginning issue is to have a rough idea of it. And just to make the idea coherent in your head, draw the entire structure on paper.
one time you are joyous with the uneven structure, conceive it on the computer.
Mark up and style with sub meal lists shown
I'd suggest that you use an unordered register with an anchor tag in each piece to construct the list like this:

<div class="menu">


<li><a href="...">Home</a></li>

<li><a href="...">Blog</a></li>

<li><a href="...">About</a></li>

<li><a href="...">Contact</a></li>


For the next grade down, use precisely the same structure as above but add it right after the connection to which you want to add the list, as follows:


<a href="...">Blog</a>

<div class="menu">


<li><a href="...">Most Popular</a></li>

<li><a href="...">Recent</a></li>

<li><a href="...">Archives</a></li>





extend this method until you have accomplished all the levels:

Style up the meal lists
To bypass confusions, separate the methods of styling and making the sub-menus display and conceal. At this stage, just aim on fashioning the meal lists, while holding the all the meal lists shown, and set their places to their appropriate positions.
Make certain the sub-menus correctly display up on rollover
Once you have accomplished marking up and given some fashioning to your CSS drop down, the last step is to put in a means to make the sub menus emerge and disemerge founded on what grade you mouse over.
Second-grade meal lists
To make the second-level meal lists emerge and go away, inject the following directions to your stylesheet:
div.menu div.menu { display: none; }

div.menu li:hover div.menu { brandish: impede; }

The first line makes a div with the class menu go away if it is established under a div with the identical class. The second line endows the div to display up if, higher up in the hierarchy of the DOM, an li is moused over.
Deeper grades
Going after second grades is an easy task. easy add an extra div.menu to both showing and hiding directions. For the showing rule, add it to the end of the selector. For the concealing direct, insert before li:hover.
Yes, it is this easy to conceive a CSS fall down. Please seem free to apply this procedure to your own website.

Leave a Comment