Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Styling Spry vertical menus

From: Site Navigation with CSS in Dreamweaver

Video: Styling Spry vertical menus

In this video, we are going to go from this inserted Spry vertical menu, which looks like this by default, to this vertical menu, which doesn't look anything like it at all. Are you up for the challenge? Let's get started. So I have now opened my mission.htm file from the Chapter 2 exercise files and we are ready to start doing some styling here. I am going to start by opening up the CSS Styles panel, and at the moment going into Current. And let's start by getting rid of this outer border that you see around here.

Styling Spry vertical menus

In this video, we are going to go from this inserted Spry vertical menu, which looks like this by default, to this vertical menu, which doesn't look anything like it at all. Are you up for the challenge? Let's get started. So I have now opened my mission.htm file from the Chapter 2 exercise files and we are ready to start doing some styling here. I am going to start by opening up the CSS Styles panel, and at the moment going into Current. And let's start by getting rid of this outer border that you see around here.

We don't need that at all. So I'll start by just selecting one of the Spry menu items, and that will bring into current mode in number of our Spry styles. Now you'll notice that there are a couple of rules that have the same selector but different properties assigned. The Spry Styles setup as it is by default tends to do this so that it can separate certain design styles like borders and font colors and the like that you see here into one area and other more structural things like font size and margin and padding in another.

Sometimes you have to look in two places to find the property that you want to modify. In this case, what we want to do is just go ahead and get rid of the border here. Now I could either delete it, or as I am going to do here, just disable it. And when I am working with Spry styles, I actually prefer to go to the All mode and use the Spry.css that I see there. It's laid out pretty logically and you can go actually from the outside of the menu in, as I like to work. So now we are going to go ahead and try to bring this menu more into keeping with the size and the look and feel that we are aiming for, and let's change the font size of the list items. And for that, we will go to ulMenuBarVertical li, and I'm going to click Edit Rule here to open up the CSS Rule Definition dialog box, and then go to the Type category, so I can choose a font family.

And I will choose Georgia which is used throughout this site, and then modify the font size from 100% to 2 em. I want to show you a quick trick. When you're working with the CSS Rule Definition dialog box, if you put in the unit measure right after the value, and then press Tab, Dreamweaver will update the unit measure list for you. Okay, we are finished with that, and now as you can see here, that brings our navigation, makes it quite large. And wait until you see the subnavigation. Even bigger. We will of course address that as we go forward.

Now one of the structural things that I notice is the subnavigation is overlapping the primary navigation, and I want to move that over and down, so let's attack that now. And that's going to be in the very next Rule that you see listed here, ulMenuBarVertical ul. Let's change the margin here from -5% and so forth to 0, 0, 0, 100%, which will put it to the right there. And if I try it, you can see that it is lined up just to the right.

Now we also need to make some other adjustments. I'm going to change the overall width of it from 8.2 ems to 6 ems to bring that down in size a little bit. Now you won't see that change in size right away, because the font size is so large. I am also going to add a background color to it, and I want to make sure that I scrolled down enough so I can sample my tan area here. And I'll just go ahead and type in background-color, press Tab so I get my color pickers, and I can open that up and with the eyedropper sample that color.

Now you will have to do this in a number of places in order to get that effect. I still want to move this menu item over just a bit, so I'll have to go to the following rule, which has the position property 'left' that you see here, and now instead of 0 I am going to make that 5 pixels instead. And once that's locked in, now you can see that there is a little bit of a separation there. Okay, so most of our structural work is done. Now, it's time to tackle the font size in the submenu.

So for this, it's the rule that follows the last one we worked on, and here we want to add a couple of properties. We are going to go ahead and change the font size and bring that down pretty radically to 0.5 em. Now if I go ahead and just preview that now, you will notice that the font size has changed radically, which is great, but I still have a wrapping problem. So I am going to go ahead and use a little-known CSS property called white-space to allow me to stop that wrapping from happening.

So just type in 'white-space' and then from the dropdown list, choose nowrap. So now if I take a look at it, I have Northern California, Central, and Southern-- each of them in a single line. Now this is one of the other places that I need to add in that background color, so I am going to go ahead and type in 'background-color', press Tab, and once again sample from the lower-left. All right! It's time to bring in the background image and adjust the padding so that the text sits neatly on the top.

And for that we are going to go down to the anchor tag, ul.MenuBarVertical a. Typically, the background image is applied to the anchor tag. So I find bringing in background images is easiest through the CSS Rule dialog box. So I am going to go up here and I am going to go ahead and just clear the default color there, so we don't have that background color. And instead we will browse for an image. And you want to make sure that you're in the proper folder, which would be 02_04 in the _images subfolder and navigate down your list until you see nav_bg.gif.

We want to make sure that this doesn't repeat, so I will choose no-repeat, and we also want to position this so that it's at the left and top. Now, this background image is actually part of a sprite. I'll click OK. So now we can see our background image is coming in, but the text is obviously overlapping. So we can adjust that by changing the padding. So I'll go over to the padding rule here and change it to .25 ems for the top, .75 em for the right, .5 em for bottom, and 1.25 em for the left.

When I press Tab, you can see that all of them line up. Now that we have our background image on the primary items, if I move over to the subnavigation, you can see I still have some work there. Let's go ahead and address that. Now in this case, I am actually going to have to add a rule. There is no anchor tag for subnavigation addressed here just by itself, so I'm going to right-click on my CSS rule that we are just working on, and choose Go to Code. I like to group these CSS Rules together wherever I can, and in this case it's ul.MenuBarVertical ul a, then we will do an open curly brace and a close curly brace. And we want to get rid of the background image, make sure that doesn't appear, so I'll type in background-image: URL(none).

Now when I go over and click Refresh, my new tag appears in the CSS Styles panel and I can add a background color property and sample my tan background. So there's actually about three different places where you have to put that tan background in to actually make it work right. Okay, we are getting closer. Let's go ahead and close that off. Now it's time to get rid of this right arrow. You'll find that the rule for it is actually in two places, and it's located below this group of hover rules that you see here.

The first one is ul.MenuBarVertical a. MenuBarItemsSubmenu, and we also want to change the one right below it. You will notice that they both have this background image property, so let's see if we can get rid of the background image properties in all of these. I am going to opt to disable these background image properties one at a time, and let's go up and do that in the previous menu as well. Okay, so that has brought us a step closer.

As you can see, there's still some issues where we have the default border bottom appearing here and we want to get rid of that, and those are located in the hover state, and the rules are found just above the two we were working with. Choose the first one, which is ul.MenuBarVertical a:hover, ul.MenuBarVertical a focus, and with that chosen, we want to disable the background color, and we actually want to change the color of it, so that it uses the orange in the logo. So I will click the color icon and then go over and sample the orange.

Now we need to add a couple of other properties. I mentioned that it still has that border bottom. So let's get rid of that by putting in a border-bottom, and then entering in the value of none, pressing Tab. And the final thing we need to do here is move the sprite over, and we do that by changing the background position. So I'll enter in background-position, and change that to a value of -272 pixels on the left and 0 from top and bottom.

So now when we hover over it, you can see that the background is changing, but we are still losing the other image, and that can be changed by addressing the second rule that has the background color of the dark blue. Again, we will go ahead and disable that, and let's change this color to orange. You have to do the same thing to the two rules. So now when we go over them, you can see that all of our hover colors are correct, and when we go over the item with the subnavigation, we also have exactly what we are looking for, which is the orange color coming up and no background graphics.

So all of these style techniques that we've applied to the vertical menu can also be applied to the horizontal one as well to create just the type of menu that you are looking for.

Show transcript

This video is part of

Image for Site Navigation with CSS in Dreamweaver
Site Navigation with CSS in Dreamweaver

40 video lessons · 18151 viewers

Joseph Lowery
Author

 
Expand all | Collapse all
  1. 2m 20s
    1. Welcome
      1m 2s
    2. Using the exercise files
      1m 18s
  2. 9m 26s
    1. Using icons in navigation
      2m 14s
    2. Understanding 3D nav bars
      2m 25s
    3. Understanding explanatory navigation
      1m 51s
    4. Creating animated navigation
      2m 56s
  3. 1h 14m
    1. Inserting Spry horizontal menus
      7m 4s
    2. Styling Spry menus
      6m 29s
    3. Adding Spry vertical menus
      5m 7s
    4. Styling Spry vertical menus
      10m 53s
    5. Using Spry tabbed navigation
      9m 33s
    6. Styling Spry tabbed menus
      9m 55s
    7. Including Spry accordion panel menus
      5m 32s
    8. Styling Spry accordion menus
      11m 10s
    9. Advanced Spry menu techniques
      8m 32s
  4. 35m 45s
    1. Converting lists to menus
      7m 56s
    2. Working with background images
      5m 47s
    3. Implementing sprites
      5m 53s
    4. Setting up adjustable backgrounds
      9m 4s
    5. Designing accessible navigation
      7m 5s
  5. 30m 34s
    1. Looking at the project
      1m 4s
    2. Building up the basic HTML
      2m 9s
    3. Displaying top-level links horizontally
      8m 12s
    4. Customizing the link states
      4m 29s
    5. Adding drop-down menus (HTML)
      3m 48s
    6. Working with submenus (CSS)
      4m 8s
    7. Achieving interactive submenus
      2m 21s
    8. Marking the current page
      4m 23s
  6. 23m 13s
    1. Looking at the project
      57s
    2. Understanding vertical menus
      2m 15s
    3. Defining width for link elements
      4m 43s
    4. Using background graphics with navigation
      5m 45s
    5. Creating pop-out vertical navigation
      6m 29s
    6. Setting link states
      3m 4s
  7. 10m 13s
    1. Identifying anchor tags
      7m 4s
    2. Identifying external links
      3m 9s
  8. 18m 14s
    1. Creating jQuery animated image menus
      7m 45s
    2. Using the HTML5 nav tag
      3m 24s
    3. Exploring CSS3 enhancements
      7m 5s
  9. 28s
    1. Next steps
      28s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Site Navigation with CSS in Dreamweaver.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.