In this part of the series I describe the HTML elements and their attributes. I do not talk about the events in this part; I will talk about the events in a later part. I will also talk about the CSS for the menu elements and sub menu elements. Throughout the series, we shall use the example that was described in the previous part.
The main menu is an HTML TABLE element. The table has one row with 10 table cells. Five cells are for the main links. Each link is in one of these five cells. Each of the other five cells is small. Each one follows a link cell and has a button. Each button corresponds to the preceding link. I will not talk about the onclick event now. This is the code for the one-row table:
<td class="link"><a href="mainlink0.htm">Main Link 0</a></td><td class="drop"><button type="button" class="drop" id="D0">v</button></td><td class="link"><a href="mainlink1.htm">Main Link 1</a></td><td class="drop"><button type="button" class="drop" id="D1">v</button></td><td class="link"><a href="mainlink2.htm">Main Link 2</a></td><td class="drop"><button type="button" class="drop" id="D2">v</button></td><td class="link"><a href="mainlink3.htm">Main Link 3</a></td><td class="drop"><button type="button" class="drop" id="D3">v</button></td><td class="link"><a href="mainlink4.htm">Main Link 4</a></td><td class="drop"><button type="button" class="drop" id="D4">v</button></td></tr>
</tbody>
</table>
For simplicity I have given the table a cellpadding of zero, a cellspacing of zero and a border of zero. Each drop-down button has an ID. The ID begins with the letter D for Drop Down followed by a number. The numbers are from 0 to 4 according to their positions.
All of the cells that have links are of the CSS class "link." Those that have the buttons are of the CSS class "drop." As you know, the CSS class is used to give the same style to all of the elements in the class (group).
Let us now talk about the DIV element that holds the sub menus. This is the code for the DIV element without the cell contents: