Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Most content management systems will write their navigation bars out as an ordered list. Even if you want that navigation bar to go horizontally, you still have an unordered list or a bulleted list, as it's also called, to work with. So let's go ahead and set that up for our navigation. We'll get rid of our default text there and we'll put it in a bulleted list. So we'll have Home, we'll have About, we'll have Contact.
This may go on for a while. Site Map. I am not going to worry much that the links here match up exactly with the comp, because ultimately, this navigation bar is going to be coming from the content management system and the text that I am typing in right now is just a placeholder. It's going to get deleted. We're just sort of putting it here so that we can style it, so that when we transport this design over to the database in the content management system, we've at least done some of the work to getting that navigation bar looking good.
So there is our bulleted list. I've just put in four items. I am going to turn them all into links now. If you'll highlight the text and click the link icon. I am just going to type in a pound sign. That's enough to create a link. Obviously it doesn't go anywhere if you click it, but since this is placeholder text, that works just fine. And I am going to repeat the process for all four links here. Okay! So our first problem is we need to get this to not look quite so much like a bulleted list.
We're going to start by removing the bullets from the list itself, then we'll float our individual navigation items out horizontally and add a little padding, and then we'll go ahead and style them to be white and in the Georgia font and not underlined. All right, so of course all of that is CSS work, so I am going to click on the CSS icon and I am going to make a new style and that style is going to be #nav ul.
That's because I'm working with the unordered list that happens to live within the div with an ID of nav. If I was making a bulleted list in the content area, I'd probably really want the bullets. So this is an exception to the overall rules for the stylesheet. So we'll create that rule. One of the first things that we probably want to do is to get rid of the bullets. Under the Lists tab, we can set our List Style Type to none, which will get rid of all of the bullets.
Unordered lists also have either margin or padding built-in around them, and it depends on the browser as to which one it is. So in our Box we'll set our margins and our padding to 0 for the top and the right and the bottom and the left. So now you can see we have a list of links and they're all nice and tightly to the side of that navigation bar.
You may also want to sort these styles so that your #nav ul style is close with the nav style, just to make your stylesheet a little easier to read. So I am going to going to nudge that up the list. We're going to make another rule now. This one is going to be called #nav li. That's for the List Item itself and for the #nav li, which once again I'll move up just under the ul. I am going to set them to float left.
See how that puts all the links all smudged together on a single line? That's great! At least now it's going horizontally, but the spacing is all wrong as you can see. So let's put some padding along these. We'll put some left padding. Let's say it's 2 ems. That'll give us good separation between those links. Let's also give it a little bit of top padding. Let's call it 18 pixels and see what happens there. Now at least we have the links in the center of the navigation bar, so we're doing well.
Now I am going to create another style. This one is going to be called #nav a:link, #nav a:visited. So this tells me that for all links unvisited that are within the nav div and all visited links that are within the nav div, do the following. I could've just said #nav a for the generic A link.
However, sometimes that styling method doesn't necessarily work correctly in all browsers and in all situations. So I like to be a little bit more specific when creating nav link styling. And once again I am going to move that up the list. Now what we need to do is we need to make these links white, we need to make them Georgia, and we need to remove the underlines. So we can do all of that in the Text tab. So we're going to set these to be once again Georgia, Times and Serif, and we're going to set our color to be white. We'll turn off the underlines.
So that's looking pretty good. That's a pretty good match to the comp. We'll say okay and we'll save our page and let's put it in the web browser and see how we're doing. Note that we have our navigation bar and our links. Everything is looking great. One thing we might want to add is when we roll over with a link, maybe we want it to change color. That's a nice effect! So let's go ahead and add that. Back to our CSS box and we'll make a new rule.
This one will be called #nav a:hover. And I will go ahead and move that up with my other styles, and I am going to set this to turn green when we roll over it, so that color is 8aa635 and I'll say okay. Once again let's save. Let's put it in the browser and now when I roll over the links, they'll turn green.
So our page is looking really good. The top looks great, the nav bar is looking great, we have our columns in place, all the styling done. The only thing we're missing now is the footer, which is the next thing that we'll accomplish.
Get unlimited access to all courses for just $25/month.Become a member