Creating a vertical link- based navigation bar using CSS in Dreamweaver 8
Designing with CSS is a process of seperating content from appearance. It makes sense that a list of links is just that - a list. In this tutorial we are going to create a vertical navigation bar based on a simple list. For a live example of the navigation we are going to build click here Step 1 - Start with a list
Step 2 - Make the list items links
Step 3 - Enclose the list in a divDiv tags like table cells are just a way of containing and controlling your content. If you had already created a page with a div for a vertical sidebar then you would insert your list between those existing div tags. In this tutorial as we are just creating the navigation bar not the whole page so we will need to enclose our list within div tags. This will create a container to hold our vertical navigation bar. Method 1: Using the Quick Tag Editor
Note: You can also access the Quick Tag Editor from the Code window if you prefer hand-coding.
Method 2: Using the Insert Div Tag Icon
From the resulting Insert Div Tag dialog box make sure that the insert drop down is set to wrap around selection. Then enter navBar in the id field and click ok. This will insert an div tag with an id of navBar around our list. At this point your list should look like the image below right.
Step 4: Style the navBar div
The #navBar should already be entered as we selected the div tag before creating the new CSS rule but... if it isn't - enter #navBar in the Selector text box. The # sign means that this is an id a type of style that can be used only once per page. For the purposes of this tutorial select the "This document only" radio button and click ok Note: you can always export your styles later by choosing File > Export > CSS styles to create an external style sheet from internal styles on a page. From the resulting CSS Rule Definition dialog box choose the background category and enter #566B2A in the background color text box. From the Box category enter a width of 180 pixels and a padding of 10 pixels (leave the same for all button selected). Then click ok. Your navBar should now look like image below left. Note: If you have your visual aids for the CSS box model enabled you can click on the edge of a div to see the padding which will be displayed with a hatched pattern as in the image below right. To enable visual aids
Step 5: Style the unordered list
From the resulting New CSS Rule dialog box you should find the correct selector already entered which is #navBar ul. If not enter it manually, making sure that the Advanced radio button is selected. Click Ok. By specifiying the style using both the container div and the ul tag allows us to specify the look of this specific unordered list. If we had other unordered lists on our page they would not be affected.
Your navigation bar should now look like the image below left. The image below right shows that the the bullets have been removed and that unordered list snugs up right to the padding specified for the container div.
Step 7: Style the linksPlace your cursor within one of the links and select the <a> tag from the tag selector. Then click the New Style button. The selector for this style should be #navBar a so that we are affecting the links only within the navBar div.
Step 8 - Styling the a:link and a:visited states
In the Type category
Click Ok Step 9: Create a new style for a:hover statePlace your cursor within one of the links and click the <a> tag on the tag selector. Then click the New CSS rule icon on the CSS Styles panel. The new CSS rule dialog should open with #navBar a we need to add :hover so that we are specifying the style for just the hover state. Make sure this document only is selected and click ok.
In the Background category
Click here to see the finished example
© TrainStation - an Adobe Authorized Training Provider
all rights reserved Author - Leslie R. Williams
|
Illustrator tutorials | Photoshop tutorials | InDesign Tutorials | Acrobat Tutorials | Dreamweaver Tutorials | Flash Tutorials | Easter Eggs
Home | About | Training | Calendar | Register | Tutorials | Freelance | Contact | F. A. Q | Become an ACE