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

CSS: Styling Navigation

Creating special effects for buttons


From:

CSS: Styling Navigation

with James Williamson

Video: Creating special effects for buttons

Browser support for many of the new CSS3 features has made it possible for us to add effects to elements that could really previously only be accomplished by using images. In this exercise, we're going to explore some of those effects as we enhance the buttons that we created in our last exercise. So I've got the buttons file open, but this time it's from the 06_02 directory. I'm just going to dive right in. We've got a lot of formatting going on with our button right now, but we're going to add a little bit more to it. Just underneath cursor, I'm going to type in border-radius, and I want it to be 0.325 ems.
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

Creating special effects for buttons

Browser support for many of the new CSS3 features has made it possible for us to add effects to elements that could really previously only be accomplished by using images. In this exercise, we're going to explore some of those effects as we enhance the buttons that we created in our last exercise. So I've got the buttons file open, but this time it's from the 06_02 directory. I'm just going to dive right in. We've got a lot of formatting going on with our button right now, but we're going to add a little bit more to it. Just underneath cursor, I'm going to type in border-radius, and I want it to be 0.325 ems.

So if I preview this in my browser and refresh it, you can see it rounds the corner of my buttons. There are a lot of different really cool CSS3 properties out there that are starting to be supported by browsers. One of them is box-shadow. Let's play around with box-shadow and see what it can do for us. So I'm going to type in box-shadow. Here's what box-shadow can do for you. You have four sets of values that you can give it. The first value would be a horizontal offset. So let's just say 5 pixels and the next value is a vertical offset.

So let's just say 5 pixels to that too. The next value is radius and what radius means is what kind of a blur do you want. So again, let's go with 5 pixels, that sounds good. And then the next thing is spread, which means how far should this spread. Let's just stay consistent and do 5 pixels and then the very next thing is color, and you can use any color you want. Most drop shadows are black, so I'm going to say black. So I'm going to save this, go out and refresh that and sure enough there we have a drop shadow. That looks awesome, doesn't it? It takes me right back to 1996.

Again, we used to have to do that by using images, but now we can do drop shadows by doing box-shadow. Now be very subtle about how you use this. As you can see, that is not so subtle. But you can use box-shadow to do a lot of different things. That's just creating a drop shadow, but you have certain values you can pass along to it. For example, if you put inset in front of it, save that, and preview it, you can see that it takes the shadow and it adds it inside, and just because I used the color black doesn't mean you couldn't use a lighter color.

So the same way that you can add shadows, you can also use this technique to add highlights. So let me show you how I'm going to use this. I'm going to change the horizontal value from 5 pixels to 0, I'm going to change the vertical value from 5 pixels to 1, I'm going to change the radius from 5 pixels to 3 pixels, and then I'm going to get rid of spread. So what we have got going on right now is we have got 0 pixels for horizontal, 1 pixel for vertical, and a 3-pixel radius, meaning how blurry it's going to be, but no spread, which is essentially going to keep it very, very thin.

Now, I'm also going to change the color of black. I'm going to change this to rgb(162,200,229), it's kind of a lighter blue color. That's not a dark shadow. This is going to be more of a highlight. I'm going to save this, go out to my browser, refresh it, and now you can see that instead of acting like a drop shadow that has no reason to exist, we've got this really nice little highlight on the button that gives it a subtle three-dimensional effect. You can use these to do a lot of really cool different things. Now box-shadow is pretty widely supported.

However, for certain mobile browsers, we still need a prefix on these. So what I'm going to do is I'm just going to copy and paste this and on the one above it. I'm going to add a -webkit prefix to it. All the rest of the browsers are supporting now the un-prefixed version, but some of those older WebKit browsers--specifically mobile WebKit--need that, so I'm going to leave it on there. Then I am going to go ahead and save that, and we're almost finished with our button. We'll just take another look at it here again. Now there are a lot of other properties out there that you could use, tech shadow for example, those types of properties can really enhance your styles.

And at the end of the course I'm going to give you a few resources where you can go learn more about those properties and creating syntax for them. Now, we still need to add some gradients to our default button, and we still need to create the rollover and active button states. So we are going to go ahead and do that next.

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