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

Exploring CSS Positioning

Positioning the menu with CSS


From:

Exploring CSS Positioning

with Candyce Mairs
Expand all | Collapse all
  1. 1m 13s
    1. Welcome
      1m 13s
  2. 33m 20s
    1. Why CSS positioning?
      5m 50s
    2. HTML editors
      3m 18s
    3. Getting set up
      3m 39s
    4. Previewing pages in browsers
      3m 51s
    5. Customizing the HTML editor
      5m 32s
    6. Exploring browser variances
      5m 16s
    7. Browser extensions
      5m 54s
  3. 30m 33s
    1. HTML vs. CSS: Which does what?
      9m 55s
    2. HTML div tags
      4m 57s
    3. CSS properties
      6m 21s
    4. The CSS box model
      9m 20s
  4. 28m 46s
    1. Planning the page layout
      3m 47s
    2. Building the header box
      6m 23s
    3. Positioning with HTML
      3m 36s
    4. Positioning with CSS
      8m 21s
    5. Foreground vs. background content
      6m 39s
  5. 25m 44s
    1. Building the menu box
      5m 7s
    2. Adding the menu links
      4m 58s
    3. Formatting the menu with CSS
      6m 43s
    4. Positioning the menu with CSS
      8m 56s
  6. 21m 42s
    1. Adding the middle column
      6m 29s
    2. Creating a CSS rule for the column
      6m 20s
    3. Adding CSS rules for the column
      8m 53s
  7. 19m 49s
    1. Adding the right column and inserting images
      7m 33s
    2. Completing the right-column content
      4m 18s
    3. Formatting the right column using CSS
      7m 58s
  8. 26m 14s
    1. Understanding the float property
      6m 5s
    2. Applying the floats
      6m 1s
    3. Finishing the floats
      6m 24s
    4. Adding CSS properties to the right column
      7m 44s
  9. 30m 59s
    1. Setting up for background colors
      5m 49s
    2. Adding a footer
      8m 50s
    3. Adding the background colors
      7m 20s
    4. Positioning the footer
      9m 0s
  10. 16m 38s
    1. Comparing the web page to the graphic design
      6m 50s
    2. Adjusting the web page as needed
      4m 25s
    3. Adding the final touches
      5m 23s
  11. 2m 43s
    1. Closing thoughts
      2m 43s

Video: Positioning the menu with CSS

At this point in time, my web page has two divs on the page. I have a Header area, with an image inside of it, I have a menu area, with hyperlinks each on their own line, with some formatting properties. And I may want to change those formatting properties once I get the positioning done. But for now there are some basics plugged in. You can see they are spread out vertically. And they do look a little bit squished together.

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...
Exploring CSS Positioning
3h 57m Beginner May 24, 2012

Viewers: in countries Watching now:

CSS enables you to control the look and layout of a web page much more precisely than you could with HTML alone, but it can be time-consuming to learn. In this workshop, expert developer Candyce Mairs makes styling a quick and easy process, walking you through the process of adding content to a web page and using CSS to position that content. Candyce explains CSS positioning concepts like the CSS box model, floats, and clears and demonstrates how HTML and CSS work together to create the look of your web page. By speaking the same language as the browser, you can learn to work with the browser to place content accurately and easily.

Topics include:
  • Previewing pages in browsers
  • Customizing the HTML editor
  • HTML vs. CSS: which does what?
  • Building the header area
  • Adding the navigation menu
  • Positioning using a float
  • Adding background colors and images
  • Comparing the web page to the graphic design
Subjects:
Web Web Design video2brain
Software:
CSS
Author:
Candyce Mairs

Positioning the menu with CSS

At this point in time, my web page has two divs on the page. I have a Header area, with an image inside of it, I have a menu area, with hyperlinks each on their own line, with some formatting properties. And I may want to change those formatting properties once I get the positioning done. But for now there are some basics plugged in. You can see they are spread out vertically. And they do look a little bit squished together.

But let me get my positioning piece in first. And then I can fine tune that formatting. So how do I add a positioning piece for the menu? While the menu is not positioned too badly right now, but it's kind of hard to tell what's going on. So what I'm going to do is get it set up for adding any positioning I want. And also give it a background color so I have some idea what I'm dealing with regards to this menu div. Let's do that first.

One of the things I want to do is I need to create a situation similar to the header. I have a Header ID up here attached to my div. Down here, I have a menu ID attached to this div. So, what I can do is copy this Header ID and place it below and just change the name. So, that is my menu ID and this specifies that it is an ID type selector.

I try and differentiate between these. Within ID selectors, I try and put only positioning properties. Within Tags or Classes, which are not addressed within this course, I tend to use those particular selectors for formatting. If I differentiate between the two, I seem to have an easier time. So I just created the menu Div. And it has a width but I think I need to give this a background color. So let me give this one a background color.

And I'll just make it green. I know the other one is blue so I should be able to differentiate now within this section. And I know my menu needs to be narrower than the page itself. And definitely narrower than the header, so why don't I make this 225 pixels. So I set that, just the menu itself, to 225 pixels in width. I'll Save my page and put it back in the browser. Let me see what happens. Let's put it in Safari.

That is definitely green. No doubt about it. But if I move this over a little bit, it's a little bit obnoxious in the green department, but at least I can see the div that I'm talking about, so I know how much space it takes up. Now what I said to do was make it 225 pixels in width. My letters are awfully squished together and that's being caused by this negative letter spacing.

So I can get rid of that, but I think this is still going to be way too wide. Let me drop this down, and I get asked quite often how do you decide what to start with? Well if you don't know just guess. You'll find half the time when you guess you get better and better at guessing. Now I wanted to make this one awfully wide to show you, which I did, so that's still a little bit wide. I'm going to be adding some padding on this left side. Because clearly this text is butting right up against the corner of this content.

I also have this little bit of space here between these Div tags, so I want to get rid of that. Although if I'm not going to have this a color, I may want to maintain that. For now, I'm not going to worry about this white space here because I'm not going to have it this crazy green. But let's adjust the other features. I'm going to add some left padding to this box. Now when I add Left Padding, or in CSS terms, it's known as Padding-left. What that is going to do, is expand or add to the size of the box in the browser.

So if I add 15 pixels of padding-left, I need to subtract 15 pixels from the width. This padding and the width now add up to 175 pixels, which is what I had before. I'll try it in Internet Explorer now, which is much harder to see in terms of the colors. I need to take that green color off. Another way to handle this instead of adding a color to entire box, what you can do is add a border instead. So, I can go down here and say Border, and I'll add Solid and within this area I'll just make it one pixel, black.

And I can actually just comment this area out within CSS. But I'll just delete it for now. Let's see what that looks like. We'll put it back in the browser. I haven't tested with Chrome in a bit. But let me go back to Safari. That's much easier to see what's going on. So what this did was add a one pixel border surrounding my box. So sometimes it's easier to just add that border do you can see what's going on instead of trying to figure out what color will work for that specific web page.

Especially if the page already has a background color, it can get tricky. So that size looks pretty good. Now my menu itself, I think these should be black. I think I'm going to set them to Georgia font, and let's see what else I'll get rid of that letter spacing. I don't think I need spacing the letters, but let me change this to Georgia, instead of Lucida Sans. Now because this font name has spaces in it, I need the quotes surrounding it. But since Georgia is just a single word, I don't need to add that. So I'll take a look at what it looks like in Georgia. I'm also going to eliminate my letters facing here and I could just comment it out, I'll just go ahead and get rid of it.

And the last piece I want to add is want the font color to be black so I can just say Color Black. That should make all of my links black and we'll take a look. Let me go into Firefox this time. That looks much more like the original design without the squished letters. They are spread out a little bit further. I want to add a little more padding on the left so that these can line up with my logo up above.

That's totally personal preference. I think I'll go ahead and do that. It's very easy. You're down to pixel size precision in terms of fine tuning. Which is a feature I love about CSS positioning so we'll put it in Safari and you can see it. 25 was a bit to much so I can probably go down 2 or 3 pixels. I'll set this to 23 instead test that one out.

Once you get working in CSS, you can see how easy it is to be bale to test these types of things. Wait until you can get it in the browser. Take a look, see what you think, and modify. It makes it very easy to shift things around a little bit. And fine tune when working in CSS positioning. Just like it's very easy to shift it using formatting in CSS. Now at some point I'll eliminate this border, but for now I think my menu isn't doing too badly. I may want some more space up above home.

But what I'm going to do is position my other columns first, and then I can always come back and set this up once I get those columns finalized. So there is the positioning piece for my menu.

There are currently no FAQs about Exploring CSS Positioning.

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 Exploring CSS Positioning.

Return to your organization's learning portal to continue training, or close this page.


OK

Course retiring soon

Exploring CSS Positioning will be retired from the lynda.com library on April 24, 2014. Training videos and exercise files will no longer be available, but the course will still appear in your course history and certificates of completion. For updated training, check out CSS: Page Layouts in the lynda.com Online Training Library.


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