In this section I show you how you can write code for a vertical menu. All along we have seen a horizontal main menu. It is not easy to use the technology of the previous series to come up with a vertical main menu. It is easy, however, to use the technology of this series to come up with a vertical main menu.
The difference between the example here and the example we have been using, is that the main menu is vertical. In fact we shall use the same menu items we used previously in this series. This is the second example of this series. The two are very similar.
The main menu items will now be in a vertical rather than a horizontal bar. These are the same items we had in the previous example. The main menu is now a short vertical bar around the left-top corner of the web page.
We cannot really talk about drop down menus here, since a drop down menu drops down from a menu item in a horizontal bar. The same drop down menus are still there, but this time they appear on the right side of the vertical main menu, just next to it. However, let us still call these particular sub menus "drop down menus," since they are the menus that appear immediately from the main vertical menu.
The second drop down menu here can produce the same sub menus that it produced when we were dealing with the horizontal main menu; and some of the sub menu items will produce the same sub menus they produced before. With the horizontal main menu (and with the exception of the last drop down menu), the sub menus were produced to the right of the drop down menu. Here, all sub menus are produced to the right of the drop down menus. The code for producing sub menus will not change.
For simplicity, the last drop down menu will not produce any sub menu, as it did in the previous case, where it produced a sub menu to its left. So we shall not have to worry about writing code for this. Even if it had to produce a sub menu, in the present circumstance, it would produce it on the right, since there is space on the right.
When a sub menu is produced, its top edge is at the same level as the top edge of the main menu item.