For this tutorial, we’ll be making a horizontal navigation bar for a zoo. It will have dropdowns and a couple of items will have flyouts to the right. We’ll simplify it the navigation by pretending our zoo has only four animals. I guess we can’t expect too many paid admissions. Luckily, after you’ve completed this tutorial you should be able to adapt this technique for any site.
Step One: Plan Your Nav
It’s really important to get organized before you code. The BluLob Zoo needs three first-level navigation items: Home, Visit Us and Animals. Visit Us will need three second-level items: Hours & Pricing, Maps, and Calendar. Animals will have two second level items – Birds and Beast, and each of these will feature two animals at a third level (Kookaburra and Hammerkop for Birds; Wolverine and Wombat for Beasts).
It will help to create an outline of how we want our navigation organized. This can be done on the computer, but I often find myself sketching things up on Post-It notes or sheets of scratch paper. Here’s my sketch:
An alternate outline would look like this:
- Visit Us
- Hours & Pricing
Both of these outlines together will help us visualize how our navigation will be built. Let’s go!
Step Two: Build the HTML
Our navigation bar has two components: the HTML on the web page, and the CSS styling which will be in an external CSS style sheet that can control every page on our site. We’ll start with the basic content in HTML without any styling. Take a look at that second outline above. We need to recreate that in Dreamweaver. Remember to save your file frequently!
- Create a new HTML page in Dreamweaver (File > New). Then select Blank Page and HTML. Choose (none) for the layout, and set XHTML 1.0 Transitional as the Doctype. Click Create.
- Save the file as menu.html (File > Save As). Click on the Design button in the Document Toolbar.
- Navigation is really just a type of list, so we’ll make our menu a list. In the Property Inspector, click on the Unordered List icon. If you cannot see the Property Inspector, go to Window > Properties.
- Type out your first level navigation: Home, Visit Us and Animals. Press Enter (Mac: Return) after each item. Don’t worry that we appear to be going down rather than across. We will finesse that in the CSS.
- Click with your cursor just after the s in Visit Us. Press Enter/Return and then press Tab. The list should indent and the bullet type should change. This will be for our second-level navigation.
- Type in Hours & Pricing and press Enter/Return. Type in Maps and press Enter/Return. Type in Calendar.
- Click after the empty bullet at the bottom of the list and press Tab. Type in Birds and press Enter/Return. Type in Beasts.
- Time for our third-level items. Click after the s in Birds. Press Enter/Return and type Kookaburra. Press Enter/Return and type Hammerkop.
- Repeat for beasts: type in Wolverine and Wombat.
- Finally, we need to set up each item as a link. We don’t have pages to actually link to yet, so we’ll put in a pound sign (#) which is a sort of link placeholder. Select the word Home. In the Property Inspector, type # in the Link box and press Tab.
- Do the same for all the other navigational items.
All of our basic HTML scripting is done. Now we need to tell Dreamweaver what CSS classes and IDs to use in the HTML. And we need to set up all of our style rules in an external CSS file.
Next: Step Three: Start Building the CSS