Having lots of high quality content isn't enough. Visitors must know that the content is there to be had, and it must be easily accessible. In this article, I provide you with simple, straight forward code that creates an expanding menu.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site

Get The Hottest Natural Health Newsletters Free!

Natural Health Newsletters Free!

[ ] Alternative Medicine
[ ] Anti-Aging
[ ] Aromatherapy
[ ] Back pain Relief
[ ] Herbal Remedies
[ ] Magnetic Therapy
[ ] Natural Nutrition
[ ] Vitamin Research
[ ] Weight Loss

Click here to see all of our newsletters, and sign up for the ones you want!

Join American Consumer Opinion™ and Get Paid Cash!
Get paid $4 to $25 for each survey
Typically $4 to $25 for each survey.
Click Here to join (Available worldwide)

Easy Expanding Menu Code

If you want your Web site visitors to stick around for a while, you need to provide lots of high quality content. But just having lots of high quality content isn't enough. Visitors must know that the content is there to be had, and it must be easily accessible.

The best solution is to place a complete menu on every page. But if you have a large quantity of content, your menu could get excessively long. One way to solve this problem is to provide an expanding menu. But most of the example code on the web for expanding menus is way too complicated to adapt for your own use.

In this article, I provide you with simple code that you can easily adapt to your own Web site. To keep it simple, the code will create a menu that expands only one level. Actually one level of expansion is all you should use, because going deeper causes loss of easy access to the content.

To use the code, you could simpley cut and paste, or download, the code and immediately modify it for your use. But you would be wise to work through the expanation below so that you become the master of the code.

The basic function of the expanding menu relies on the style sheets "display" property. To expand a submenu, we will set the "display" property of the submenu items to "block". This value causes an element to be followed by a line break. The line break will keep the menu items in a nice column. To hide a submenu, we will set the "display" property of the submenu items to "none". This will cause the submenu items to disappear.

Open a text file and enter the code for a table, as shown below. This defines the basic structure of the expandable menu.

<table>
  <!-- MENU 0 -->
  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Menu 0</a></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Submenu 0</a></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Submenu 1</a></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Submenu 2</a></td>
  </tr>

  <!-- MENU 1 -->
  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Menu 1</a></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Submenu 0</a></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Submenu 1</a></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Submenu 2</a></td>
  </tr>

  <!-- MENU 2 -->
  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Menu 2</a></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Submenu 0</a></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Submenu 1</a></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td><a href="#">Submenu 2</a></td>
  </tr>
</table>

- Note: If you've fogotten basic html, the tags <tr></tr> define a table row. Within a table row, the tags <td></td> define a table cell.

Web Design Sections

RSS Feed RSS Feed

Cascading Style Sheets

[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2007 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269