Introduction
CSS menus are created using formatting and positioning of standard HTML. The underlying structure is simply a nested list. The visible portion of the menu is the outermost list, and the drop-down portions are sublists. Each item in the list is a link to the content. The associated formatting of the sheet changes the display of the submenus depending on whether or not the mouse is over the outer list item. Depending on the method used, the submenu may be set to display off the screen, or not be displayed at all unless the mouse is over the "Home title". When the mouse hovers over the title, the inner list is displayed overlapping the outer, so that the Home "drops down".
In fact, however, keyboard navigation is virtually impossible with this kind of menu because, while the tab key moves the "focus" to the submenu items, the user has no way of knowing what item is currently selected, or even what items are available. The only items that can be reliably accessed are those of the outer list.
Step 1: Open Macromedia Dreamweaver.
Step 2: Then create a new document by clicking the File menu then New Document.
Click the Create button.
Step 3: HTML 5 Doctype:
- <!DOCTYPE html>
- <html dir="ltr" lang="en" xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta charset="utf-8" />
- <title>Title </title>
- </head>
- <body>
- Create Text here
- </body>
- </html>
Step 4: Define the body part and set the content of the CSS Dropdown Menu:
Code
- <nav>
- <ul>
- <li><a href="#">Home</a>
- <ul>
- <li><a href="#">SubMenu Text here 1</a> </li>
- <li><a href="#">SubMenu Text here 2</a> </li>
- <li><a href="#">SubMenu Text here 3</a> </li>
- <li><a href="#">SubMenu Text here 4</a>
- <ul>
- <li><a href="#">SubMenu Lable 2 Text here 1</a> </li>
- <li><a href="#">SubMenu Lable 2 Text here 2</a> </li>
- <li><a href="#">SubMenu Lable 2 Text here 3</a> </li>
- <li><a href="#">SubMenu Lable 2 Text here 4</a> </li>
- <li style="border-bottom: none;"><a href="#">SubMenu Text Lable 2 here 5</a> </li>
- </ul>
- </li>
- <li style="border-bottom: none;"><a href="#">SubMenu Text here 5</a> </li>
- </ul>
- </li>
- <li><a href="#">About us</a></li>
- <li><a href="#">Services</a></li>
- <li><a href="#">Portfolio</a></li>
- <li><a href="#">Contact</a></li>
- </ul>
- </nav>
Step 5: Apply the stylesheet of the Dropdown Menu:
Code
Step 6: Write the complete code for the developed simple CSS Dropdown Menu that uses the HTML 5 tools.
The complete application is:
Output