Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
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.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 99991 Viewers
56 Video lessons · 113064 Viewers
71 Video lessons · 81908 Viewers
131 Video lessons · 39303 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.