Spry Navigation in Dreamweaver CS3
CATEGORIES: Tutorials, Dreamweaver | Janine Warner | February 27, 2008
One of the most dramatic enhancements to Adobe Dreamweaver CS3 is the Spry framework, a new set of tools that you can use to create drop-down menus, collapsible panels, and other advanced features. There are so many Spry features, Adobe added a new Insert Bar to the top of the work area to provide easy access to all of the Spry options.
The following tutorial shows you how to create a horizontal drop-down menu bar for site navigation. (You can also use these steps to create a vertical menu bar by selecting Vertical instead of Horizontal in Step 5.)
[Download a preview of this project, here. All files are for personal use only.]
STEP 1 Plan Your Navigation Needs
Even before you start creating a navigation menu like the one shown here, take some time to plan how best to organize the site’s links and structure. As a general rule, it’s good practice to limit the number of links in a navigation bar to no more than six or seven. As a result, many Web designers divide a site into a few main categories and then further divide those into subcategories. For example, this site has a section called “Talent” as a main category, and then has subcategories for talent with different jumping skills.

CREDIT: JASPER JOHAL
STEP 2 Set Up Your Site
You can add a Spry menu to a new or existing page, but like most of the features in Dreamweaver, things work better if you first define your website. If you’ve already gone through the site setup process, you’re ready for the next step. If you’re creating a new site, choose Site>New Site, select the Advanced tab, and fill in the fields in the Local Info category. For more detailed instructions, read the online tutorial “Defining a Site in Dreamweaver” at www.layersmagazine.com/defining-site-dreamweaver.html.

STEP 3 Create New Page/Open Existing One
To create a new page, choose File>New and then select a file type. In the New Document dialog, you can choose from a variety of file types, including ASP, PHP, and CFM; however, if you’re creating a new page for a basic, static website, choose Blank Page, HTML, and a CSS Layout (or choose None to create a completely blank page). If you choose one of the CSS Layouts, you can alter the layout to suit your design by editing the CSS definitions. (You’ll find tips for editing CSS layouts like this one in Layers, July/August 2007, p. 72.)

STEP 4 Insert Spry Navigation Menu
To insert a Spry menu, first open the Spry Insert Bar at the top of the workspace by clicking on the Spry tab. Place your cursor where you want to create the menu in your webpage, and then click on the Spry Menu Bar icon (or go to Insert>Spry>Spry Menu Bar).

STEP 5 Choose Horizontal or Vertical
You can use the Spry Menu Bar dialog to create a menu that displays horizontally across your page with submenu options that drop down below the menu bar. Or you can create a vertical menu bar with submenu options that open to the right of the main menu items. Click on the corresponding button to make your selection and then click OK to insert a generic menu bar into the page. Once the menu bar is inserted, you can customize it by changing the text, colors, fonts, and other options.

STEP 6 Adjust Alignment
The format of a Spry menu is controlled by CSS; thus, to alter the appearance, you need to edit the CSS definitions. By default, the horizontal menu aligns to the left of the page but you can easily align it to the right by changing the definition of the corresponding style. To change alignment, we need to change the Float setting. Start by selecting the style named “ul.MenuBarHorizontal li” in the CSS panel, and then in the Properties pane below it, click to the right of the Float field and use the drop-down list to select Right instead of Left.

STEP 7 Replace Main Text
When a menu bar is inserted, Dreamweaver populates it with placeholder text: Item 1, Item 2, etc. To add your own text, simply click-and-drag to select the text within each navigation box and then type over it to replace it with the word or words you want to use. As you can see, we’ve replaced Item 4 with Agents, and Item 3 with Talent, and we’ve selected the next item. Note: You can also edit menu items using the Properties inspector, as you’ll see in Step 8.

STEP 8 Display Spry Menu Options
To edit the text in the submenus, or to add or remove menu items, you first need to display the Spry menu options in the Properties inspector. To make these options visible, click on the blue tab at the top left of the Spry menu that you inserted into the page. In this example, it’s labeled “Spry Menu Bar: MenuBar1.” When you click on the menu tab, the Properties inspector displays the corresponding Spry options.

STEP 9 Edit Submenu Text
With the Spry menu options open in the Properties inspector at the bottom of the work area, you can edit the submenu text by first selecting the menu item in the leftmost menu field and then selecting the submenu item in the middle menu field. You can edit the text of any selected item in the Text field at the far right of the inspector. In this example, we’ve replaced Item 1.1 with LA Office, Item 1.2 with NY Office, and Item 1.3 is selected so that the text can be edited in the Text field.

STEP 10 Add or Remove Menus and Submenus
You can add menu or submenu items by selecting any item listed in the Properties inspector and then clicking on the plus (+) sign at the top of the corresponding menu field. To remove a menu item, select it and click the minus (–) sign. For example, you can add a third-level menu item by selecting a submenu item and then clicking the plus sign above the third menu field. Here, we’re adding a third-level submenu item, Manhattan, to the submenu item NY Office, which is a submenu item of Locations.

STEP 11 Create and Edit Links
A menu bar, by design, should include links to the main sections and subsections of a website. To turn any menu item into a link, select the item in the Properties inspector and enter the URL in the Link field. You can also use the Browse icon (it looks like a file folder) to locate and select any file in a website and set the link automatically. If you’re setting a link to a top-level menu item, you can also select the text in the main workspace and set the link in the Properties inspector.

STEP 12 Change Text and Background Colors
To edit the text and background colors in a Spry menu, you must edit the corresponding styles. The tricky part is that the style definitions for text and background colors are included in the link styles, which have multiple states. For example, the style named “ul.MenuBarHorizontal a” defines the background and text color that display when a browser first loads a link. However, if you want to change the text or background color that appear when a visitor rolls a cursor over a link, you’ll need to change the definition for the style named “ul.MenuBarHorizontal a:MenuBarItemHover….”

STEP 13 Change the Font Face or Style
By default, the font in a Spry menu is the same as the page font. Thus, if you’ve created a Body style to specify the page font as Verdana, the Spry menu text will also display in Verdana. If you want to change the font used in the menu without altering the page font, you can add a font definition to the style named “ul.MenuBarHorizontal.” To do so, double-click on the style name in the CSS panel and in the CSS Rule Definition dialog, enter a font face or choose a font collection from the Font drop-down menu.

STEP 14 Preview in a Browser to Test
To test a Spry menu, you’ll need to preview your page in a Web browser, such as Safari or Firefox. Just click on a menu or submenu item to see the drop-down items in action and test the links. Beware: If you have two levels of submenus on the right side of the screen, as in this example, they may extend beyond the page display area.
Visitor Comments
claire | March 12, 2008 11:38am
Any adjustments to a spry menu have to be made in the corresponding CSS files. You'll need to find the CSS rule that defines the positioning of your submenu and adjust it by changing the settings in the CSS Styles panel.
Janine Warner | March 12, 2008 16:39pm
How do you make the navigation stretch to fit its container, my "wrapper" div is 760px but my spry menu only covers about 65% of that width...
andrew felder | March 14, 2008 14:31pm
dear jeanine,
last year i bought your DVD on dreamweaver 8,
it is done very well and i plan to buy your new one.on drmw8 there is no section that covers how to create a page that clicking "previous/next one can navigate through several images yet the page stays the same.how can i learn to create pages with this features.
sam | March 16, 2008 18:37pm
Is there a way to get the text from the menu into a CSS file so that the pages should all be the same.
Joe | March 24, 2008 15:25pm
i need to know more about the spry menu bars use, and how to change the colour of background and to get menus in same levels.
safana | March 25, 2008 11:48am
How can I create a Transparency Navigation when u use SPRY?
Anthony | April 01, 2008 09:19am
I am doing a spry for the first time ever. I have created a vertical menu bar. How do I remove the border?
BB | April 08, 2008 12:45pm
Thanks for intro into spry. Have had a little play and one neat trick I have found is to manually move sub menus.
In properties bar click on a sub menu item.
In 'design mode' you can then click on the edge of the sub menu that shows blue outline. Top left is a square that you can manually ‘grab’ and move the position of whole sub menu - cool!same applies for sub sub menu of course
I must admit that when I tried to navigate round the css adjustments as shown in your tutorial it was confusing and daunting.
HOWEVER if you go to spry assets folder and open the css sheet it has been annotated by Adobe making it a lot easier to follow
Hope this is of interest
Rowan Bouy | April 08, 2008 15:26pm
I am editing css for my spry nav bar and can't figure out how to have a different background color for the tab of the page that is open. For example when I am on the HOME page I want that tab a different color so the visitor knows what page they are on. I don't see a style in the menu bar css that describes this condition. How would I write the selector?
Suzanne | April 09, 2008 14:22pm
Hi, I'm having trouble with the spry vert nav bar in IE7. Not all of the menu items are left justified like they are in FF and Netscape. I do have the z-index 'hack for IE5' in my
sprymenubarvertical.css. Is there any new 'hack' code to make it work in IE7?
Lamia Stanton | April 10, 2008 06:38am
Figured it out....removed the
f\loat: left;
background: #FFF;
from the IE5.0 hack. My site looks great now in IE7.0 (don't know about IE5.0) and in all other (normal) browsers :) -Lamia
Lamia Stanton | April 10, 2008 13:37pm
My spry nav menu works fine in IE7, but not in Firefox. Is there a simple fix?
Erin | April 14, 2008 19:16pm
I create a behavior in an image to open a large image in a new window, but there is a blue border in my image once I add the # sign in the link properties. How can I remove this hyperlink border
MiguelAngel | April 21, 2008 09:26am
Here’s how to remove an image border:
The border is automatically added to distinguish that the image is linked, even though you're just using the #sign as a holder.
It's easy to remove.
Click to select the linked image in the main Dreawmeaver design area, then in the Property inspector at the bottom of the workspace, enter a 0 in the Border field. This sets the size of the border to 0, making it disappear.
Hope that helps,
Janine Warner
Janine | April 21, 2008 21:26pm
I have created a Spry vertical navigation menu in a Div on the left side of my site pages that looks great in Firefox, but it doesn't show up in IE6 or IE7. What do I need to do to fix this? I've tried to find answers in my books and on the web, but I'm stumped. Thank you.
Debbie Wolfe | April 29, 2008 19:48pm
I have created a Spry vertical navigation menu with a blue background. It looks ok in dreamweaver but when I test it in a browser the backgound color is only behind the text and not the whole box. What did I do wrong?
Bob L | April 30, 2008 21:21pm
I would like to use a Spry menu on our site, but am concerned about updating the menu after the initial implementation. We have over 3,000 pages on the site so when we change the menu in the main template, I want to be able to upload a single file and the changes will appear in all pages without having to reload the individual pages themselves. Can you do this with Spry menus or do all pages have to be reloaded?
Morris Enyeart | May 07, 2008 15:53pm
Leave us a comment

- Moving Around When Zoomed In - May 09
- Filling Used Pixels - May 08
- Match Zoom - May 07
- Eyedropper Shortcuts - May 06
- Letter Spacing - May 05










Digg This!
Del.icio.us
Blinklist

Photoshop
Illustrator
Indesign
Dreamweaver
Photography
Flash
After Effects
Lightroom