Start learning with our library of video tutorials taught by experts. Get started

CSS: Styling Navigation

Setting link styling


From:

CSS: Styling Navigation

with James Williamson

Video: Setting link styling

Most of the steps to creating our vertical menu are pretty straightforward, and you are going to find yourself repeating them each time you build a vertical menu. Link styling, however, is where your creativity really is going to come into play. By setting things like foreground and background colors, using images, or maybe even icons and how you style the text, you can really take every single menu and make it unique and make it fit in with your site's design. So I'm going to continue working on the vertical.htm, but this time I'm working on it from the 03_03 directory, and I am going to continue working in the descendent selector that's targeting our links, the li a selector.
Expand all | Collapse all
  1. 3m 8s
    1. Welcome
      42s
    2. What you should know before watching this course
      1m 12s
    3. Using the exercise files
      1m 14s
  2. 35m 25s
    1. Organizing menus with lists
      4m 26s
    2. Ensuring accessibility
      9m 3s
    3. Using the nav element
      7m 30s
    4. Creating block-level links
      3m 8s
    5. Lab: Structuring navigation
      4m 11s
    6. Solution: Structuring navigation
      7m 7s
  3. 48m 42s
    1. Exploring link style considerations
      9m 2s
    2. Using global link styles
      9m 56s
    3. Styling link states
      10m 57s
    4. Indicating external links
      10m 4s
    5. Styling image links
      8m 43s
  4. 52m 5s
    1. Stripping default list styling
      4m 34s
    2. Defining link dimensions
      6m 0s
    3. Setting link styling
      3m 36s
    4. Aligning links vertically
      4m 11s
    5. Controlling link spacing
      2m 30s
    6. Styling menus with borders
      2m 32s
    7. Creating rollovers
      4m 45s
    8. Restricting link styling
      3m 31s
    9. Lab: Creating a vertical menu
      11m 44s
    10. Solution: Creating a vertical menu
      8m 42s
  5. 54m 58s
    1. Stripping list styling
      3m 35s
    2. Displaying links horizontally
      6m 14s
    3. Clearing floats
      6m 12s
    4. Controlling link sizing and spacing
      3m 11s
    5. Styling links
      7m 16s
    6. Creating rollovers
      5m 52s
    7. Indicating current pages
      4m 43s
    8. Controlling cursor states
      2m 46s
    9. Lab: Creating horizontal menus
      6m 45s
    10. Solution: Creating horizontal menus
      8m 24s
  6. 55m 35s
    1. Overview of dropdown menus
      1m 17s
    2. Structuring submenus
      5m 56s
    3. Styling submenus
      6m 4s
    4. Creating submenu rollovers
      3m 28s
    5. Positioning submenus
      5m 43s
    6. Controlling submenu display
      5m 5s
    7. Creating persistent hover states
      5m 53s
    8. Animating menus with CSS transitions
      6m 29s
    9. Lab: Dropdown menus
      6m 51s
    10. Solution: Dropdown menus
      8m 49s
  7. 58m 7s
    1. Creating CSS-only buttons
      8m 39s
    2. Creating special effects for buttons
      4m 2s
    3. Enhancing buttons with gradients
      7m 40s
    4. Overview of CSS sprites
      3m 30s
    5. Using CSS sprites for icons
      14m 30s
    6. Styling block-level links
      8m 38s
    7. Lab: Enhancing navigation with CSS
      5m 26s
    8. Solution: Enhancing navigation with CSS
      5m 42s
  8. 6m 29s
    1. Additional resources
      6m 29s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
CSS: Styling Navigation
5h 14m Beginner Nov 16, 2012

Viewers: in countries Watching now:

Join James Williamson, as he shows you how to create elegant menus, links, and buttons that help visitors navigate your site faster and more intuitively. The course covers creating structured navigation that is accessible and clean, styling links, and building horizontal and vertical menus with rollover effects. The last chapter reveals how to create stylish buttons with special effects and CSS sprites.

Topics include:
  • Organizing menus with lists
  • Creating block-level links
  • Styling links, link states, and image links
  • Defining link dimensions
  • Controlling link spacing in a menu
  • Creating rollovers
  • Clearing floats
  • Indicating current pages
  • Controlling cursor states
  • Building dropdown menus
  • Creating CSS-only buttons
Subjects:
Developer Web Web Design Web Development
Software:
CSS
Author:
James Williamson

Setting link styling

Most of the steps to creating our vertical menu are pretty straightforward, and you are going to find yourself repeating them each time you build a vertical menu. Link styling, however, is where your creativity really is going to come into play. By setting things like foreground and background colors, using images, or maybe even icons and how you style the text, you can really take every single menu and make it unique and make it fit in with your site's design. So I'm going to continue working on the vertical.htm, but this time I'm working on it from the 03_03 directory, and I am going to continue working in the descendent selector that's targeting our links, the li a selector.

So, now that I'm actually styling the link content themselves, I want to concern myself with things like text formatting, font size, font weight, font style. I want to concern myself with color. I want to concern myself with what's going on in the background, am I going to use a background for these? One of the things that you need to keep aware of--we're certainly not going to do it for this menu which is because this is kind of a simple one--you have two other elements in this case, and sometimes you'll have more than that, but the unordered list and the list element both allow you to apply backgrounds to them as well, and because of the way the links are nested, they'll actually stack on top of each other, so the links will be on top of the list items, which will be on top of the unordered list.

So you can actually have multiple backgrounds sort of one on top of another. Now with CSS3, we're also allowed to do multiple backgrounds, but that's not as widely supported. So a lot of times you might have to use multiple selectors in order to achieve really complex effects. Again, we're going to focus on relatively straightforward formatting here. So the first thing I want to do is just control the font size itself in some of the text formatting. So I'm just going to type in font-size, and I'm going to make that 1 em and then for text-decoration, I'm going to turn that off, I'm going to say none.

Now, that's going to remove the outline, and it's going to make the font-size 1 em, which is basically just 100% of whatever user agent we're viewing that on. All right, I'm going to go ahead and save that and preview this in my browser. Let me go ahead and refresh the page, and you can see it doesn't really do anything in terms of resizing the text, the text stays pretty much the same size, we've just given a definition to the size that we want and the underline text decoration goes away. So, so far so good. Now the next thing I want to concentrate on is color. So I'm going to set a background first, and the reason for that is I am going to change the color of the text to white, and trying to preview that first will be kind of difficult.

So I'm going to go down to the next line and I'm going to use background property and I'm going to set a background color to #D5973C, and if you've done any of the previous chapters, you're probably familiar with that color. I'm using that a good bit for navigation within these exercise pages. So it's a pretty standard color, it's going along with the navigation scheme that I've been using in some of the other pages. I'm just staying very consistent with that. And then I'm also going to set the color to white, and there are several different ways to do that, but when I'm using white or black, I just use the keywords.

So I'm going to save that, browse out to the page, refresh it, and wow! What a dramatic change just those couple of properties had with our menu. It's actually looking like a menu now, rather than just sort of a list of links. Of course, if we hover over them, we don't see any big change, and if I tab through them to establish focus on them, I can see that the placement of the text within the links really isn't ideal, but we're certainly on the right path to making our menu look the way we want it to. So we still need to do a little bit of refining on the style, and we're going to tackle that in our next exercise by vertically aligning the text and adding a little bit more interior spacing to the links themselves.

There are currently no FAQs about CSS: Styling Navigation.

Share a link to this course
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.
Upgrade now


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.

Upgrade now

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 CSS: Styling Navigation.

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
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



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.

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