Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
>> In the last chapter, we learned how to create HTML lists and saw how useful they can be too many screen reader users who can often jump directly to them or skip over them. In this chapter, we'll continue working with lists over several movies to create navigation elements for the example site we've been developing. We'll also go over creating accessible links and fly out menus. If you're following along with the exercise files, open the page visitors.html from the folder 05_01 in the chapter five exercise files.
We're going to add a navigation bar to this page so that we can start building other pages in the site and linking them all together. Go to Dreamweaver's insert toolbar at the top of the screen. Click on the layout tab. Click the insert DIV tag button, which is immediately to the right of the button labeled, expanded. This brings up the insert DIV tag dialogue box. From the Insert menu, choose before tag. Then in the adjacent menu, select DIV ID sidebar 1.
In the ID box, type name then capital NAV. Now click the new CSS style button. This brings up a new dialogue box asking you to create a new CSS rule. We'll first create some styles for this new DIV then go back to the insert DIV box to add it to the page. Leave the selector type of advanced chosen and leave the selector name of main NAV in the selector field. Also, keep this document only selected in the define in option, then click okay.
In the CSS rule definition dialogue box, first choose the color option. Click on the color picker and choose white. Next, click on the background category of the dialogue box. Click in the field to type a background color. Type #272910. We're also going to set a background image on our main navigation DIV. Click the browse button beside the background image field. This brings up a dialogue box where we can select the image to use.
If you're using the exercise files, browse to that location on your machine then choose chapter five, then 05_01, then the images folder and then choose the mainnav_bg_image file. Click okay. Back in the CSS rule definition dialogue box, click on the Repeat menu and choose repeat X. Finally, in the Vertical Position menu, choose bottom. This will take the background image that we've added and repeat it across the page horizontally.
It will pin it to the bottom of the DIV so that as the text grows bigger, the background color that we've set will fill in the extra room above the background image if it becomes too small to fill the new height of the main NAV DIV. Let's set one more style for this DIV. Click on the border category of the dialogue box and uncheck all of the three same for all checkboxes. We're just going to set a border on the top of the box, so in the top box, underneath style, click on the menu and select solid.
In the top box under width, type 1 and leave pixels selected as the unit of measurement. Under color, click on the color picker for the top option and select white. Now click okay. We're taken back to the insert DIV tag dialogue box. That's because we still haven't added this DIV to the page, we've just created its styles. We've already told Dreamweaver where we want the DIV to be added to and what it's ID should be, so now we can click on okay.
The new DIV is added to the page with placeholder content. We're going to place a list with the main areas of the site into this new DIV. In the exercise files, open the file mainnav.doc from the chapter five folder. Select all of the content in this document then hit control C or command C on the keyboard to copy the text. Return to Dreamweaver. We want to make sure that this text pastes in with its structure intact. If you're not sure if your copy of Dreamweaver is set to do this by default, go to the edit menu and choose paste special.
Here we can choose to paste in the text with its structure. Click okay. Let's go into the code view to make sure that Dreamweaver pasted in the content correctly. Click on the code view button in the document toolbar. We're taken to the point in the document of the main NAV DIV. The first element what pasted in was an H2 element. This labels the section as the main navigation section, just like we did for the section navigation for the footer areas of the site. We next have a UL element, an unordered list, but you can see that there's an extra UL tag at the beginning of this list.
We don't want that here so delete it. Highlight over and just delete. Now the structure is as we need it. We have a main NAV DIV, a heading and an unordered list. Click on the design view button. Now we need to add links to each of these items. Click on the link field on the properties inspector. Type index.html. Next, highlight over residence. Then click in the link field and type residence.html.
Highlight business and type business.html for its link. Highlight over government and type government.html for its link. Highlight over visitors and type visitors.html for its link. Highlight over departments and type departments.html for its link. And finally, highlight over newsroom and type newsroom.html for its link.
We now have a main navigation area with a heading to label it as such and then a series of links to the main areas of the site. Since the main links of the page are made with a list, screen readers can easily jump over the entire list and get straight to the next block of content, but this definitely doesn't look like a NAV bar yet. Next, we'll add the CSS to transform the appearance of this list into a standard type of NAV bar.
Get unlimited access to all courses for just $25/month.Become a member