Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Welcome to our horizontal menus lab. This lab is going to be just a little bit different from the last one in the record that I'm going to give you a few parameters for our site's menu, but it's going to be up to you to decide exactly how you want to style it. So I have two files that we are going to be working on in our lab opened up here. I have got the index.htm and the main.css opened up. You can find these in the 04_09 directory, and I want to point out that the main.css is found in this _css submenu.
So those are the two files that you are going to be working with. Now the instructions for this lab are at the very top of the main.css file. I am going to go through the steps for the instructions, and as I go through some of these individual ones, I am going to preview the finished version of the site menu so you can see what your target styling goal is. So the very first thing you want to do is browse through the structure of the HTML code, find a nav element with the ID pageNav, and really carefully look at that structures. So I am going to show you that.
In the source code, if I scroll down--and you don't want to go very far--right around line 18 or so you're going to find our site menu. Here we have a nav element that has an ID pageNav. So we are not using a class here, we are using an ID, and then we have unordered list with all the links inside of it. So it's a fairly simple structure very similar to what we're using earlier in the chapter, but to remember we do have that nav element, and as you begin to write selectors you're going to want to remember the ID of it, and you're going to really examine the structure so that you know how to write your selectors.
Now, the next thing that you want to do is you want to scroll down and find the styles that apply to the pageHeader h1 element. I am going to show the finished site layout so I can show you what I'm talking about here. The h1 is being styled as the Roux Academy logo here in the upper left-hand corner of our page layout. As you can see, the menu sits just to the right of that nestled at the very top of the page. So obviously, you're going to need to familiarize yourself with how that header is being styled so that when you style the menu those two items are working together.
Now to find those styles there in main.css, and I am just going to scroll down and show you where these are. It takes a little while to get down to them, but they are right here on line 216. They are header styles. There's not a lot going on there. There are only two selectors, but there's a lot of valuable information such as the width of the h1 that you're going to need to know about as you begin styling your menu. Now the nav styles themselves is individual styles you will actually write those right here at about line 233 just below that. Scroll back up here.
Now that you know the sections that you are going to be affecting and sort of where you are going to be writing your code I want to go over these steps to build the actual menu itself. Now unlike the previous labs where I've given you step-by-step instructions on exactly how to build it, I am just going to go give some parameters and give you some the values of the colors that are used, but other than that, I am going to totally leave it up to you to style the menu the best way that you see fit. Now these parameters are just below this. I am going to talk about them by looking at the actual menu itself.
So I am not going to spend a lot of time here, but when I reference colors if you come back into these instructions you'll find those color values right in here for each one of these steps. You can just copy and paste those colors, or you can certainly come up with your own color scheme. So here's what you'll need to do. The menu needs to appear just to the right of the Roux Academy logo, and it needs to go ahead and stretch all the way out for the remainder of the layout. Now this is the fixed with layout, meaning it's been designed to fit a specific width, in this case, 960 pixels.
You want to take a look at the body element, understand how much space you have, and then use that to determine how wide the menu should be. Now the background color of the menu is a very dark color, almost black. The RGB value is in the steps as I mentioned, but I'm also using an Alpha setting here, which is the semi-transparency. So that's one of the reasons why we can see the background image behind it. So take a look at those. Now if you want to change that and do something different with the menu, feel free. The next thing you'll need to do is you are going to want to space these menu items out so that it stretch almost across the entire menu.
If you want to add a little bit more space or have less space, that's totally up to you. It's whatever your personal preference is going to be, but remember, you want to have at least enough room to where it's very easy for somebody to go through the menu and select them, and then they know exactly what they're looking at when you do that. I used white text, and then I used the orange color for a rollover. If you want to change those, you can. I have also made all of the link text lowercase. You want to make it slightly smaller than the default text size, and it also needs to center vertically within the menu.
I've also added a little bit of padding to the links so that not only do I have enough active space on either side of the link, but later on when I show you guys the current page indicator you've got enough room to make that sort of tab look that we are going to be doing here as well. Also, you want to make sure that no background image shows up. Remember, we have the default diagonal pattern that shows up in all links, so you're going to want to disable that for your rollovers. Also, I've got a current page indicator that you're going to need to build, and I am just going to click through these different pages so you can see that current page indicator.
It's kind of like a tab shape. So I used a background color that's very close to white with an Alpha transparency, and notice that I have also changed the text color to black. I am rounding off the top corners, and as you can see, the cursor is not displaying, so I've turned the cursor back to that default cursor for those particular links. Remember that getting this current page indicator to work is actually a two-part process. Not only do you have to write the styles for it, but you're going to have to go into each of these individual pages and apply to your appropriate class or ID, depending upon which you choose to go with for that particular page.
I do realize it's going to be a little harder than your previous labs, but I really wanted in this lab for you to experience what it's like to have to plan and execute a menu within a much larger site. Don't forget you can open up the files located in the finished default folder and take a peek at the finished code if you're stuck and also be sure to watch the solutions movie where I explain why I wrote the menu styles the way that I did.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101773 Viewers
61 Video lessons · 88535 Viewers
71 Video lessons · 72348 Viewers
56 Video lessons · 104059 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.
Your file was successfully uploaded.