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

Exploring CSS Positioning

Finishing the floats


From:

Exploring CSS Positioning

with Candyce Mairs

Video: Finishing the floats

I have just applied the Float Property to my three columns of content on the page. And what I want to do now is work within the box model in CSS to spread these out a little bit more. I'll be looking at the margin and padding properties of these three divs on the page, and fine-tuning them so they fit a little better, underneath my header. Let's take a look at adding or modifying properties for a div tag within CSS. Now, if I take a look at this page, and I'm doing it right here to make it easy, you can see my three divs lined up next to one another. But I do have some space over here.
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

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

Finishing the floats

I have just applied the Float Property to my three columns of content on the page. And what I want to do now is work within the box model in CSS to spread these out a little bit more. I'll be looking at the margin and padding properties of these three divs on the page, and fine-tuning them so they fit a little better, underneath my header. Let's take a look at adding or modifying properties for a div tag within CSS. Now, if I take a look at this page, and I'm doing it right here to make it easy, you can see my three divs lined up next to one another. But I do have some space over here.

You can also see that my text is pretty tight along the edge of each one of these div tags. So, I'll start at the left and work my way over to the right. Now, my menu here doesn't look too bad. I may want to move my first link, my home link, down a little bit. And I can do that by adding some padding at the top of this menu div. So, I'll go to the menu div, which I have right up here.

I have a left padding here on this menu box, and that's why my text is over from the left-hand side by 23 pixels. I'm going to do that same thing, adding some padding at the top of this box as well. So, I'll go into my CSS and put in padding top and let's say maybe 15 pixels. If you're unsure what to start with just pick a number, you can see that my home link has moved down by those 15 pixels. And it looks fairly well lined up with this colomn of text at the moment. I might even want to move it down, just a little bit more. Because I think this is a little tight as well.

So, let me switch this. I'll change it to 25 pixels. And let's see how that looks. Now, that's a pretty substantial change, and I don't have pixels in here. So, you can see if it can't understand it, it doesn't know what to do, so most browsers will do nothing. There we go. I think that menu looks a little bit better. Now, it's so easy to modify this just by changing this padding top number.

I'll leave this one as it is. And once I get these other two set up the way I want, I can always come in and move this down a little bit. If I decide to reduce that number 25x2 or 3 pixels, or whatever is needed to line up with the rest of the content. Other than that, my menu looks pretty good. So, I really can take the border off my menu as well. Don't really need that anymore. I'll get rid of it, and you can see my menu looks great. Now, let's move on to the next column, and it's basically the same process with all of these.

Now, my left column is this one here. So, what I'll do is move the CSS up. I'm going to want to put some padding on this box, and there's a couple of ways to do it. I can specify just padding left, padding top, right or bottom. There's four sides to a box, or I can just use the property padding. Just all by itself.

And if I use padding all by itself, what it does is add the padding to all four sides at the same time. So, you can see now I have 20 pixels and 20 pixels on the left. Now, my padding might be a little high. That's kind of a personal preference. So, if I decided I didn't want 20 on all four sides, I can go back to adding just the left and top or I can be more specific just using padding. So, what this means is the first number is top, right, bottom and left. Think of it like a clock where you start up at 12, 3, 6, and 9. So, you go clockwise around the box.

So now, if I want to eliminate a little bit of padding on the top of this box, I can just change padding. And instead of 20, I can put it to 10. And you can see how this is moving up and down based on the numbers I place in here. So, this first number is top, right, bottom, and left. That looks pretty good. I've got some padding all the way around my box. I've also got some padding at the bottom.

I think I can eliminate this border now from my box. So, I'll go ahead and delete that, and you can see my page is starting to come together. So, that is how I can start fine-tuning each div tag once the floats are lined up. What I'm doing is modifying properties within each div, specifically the properties of padding so far. I didn't work with margin. I generally worked with padding to add some space inside the box for my content to spread this out. You can see now that that's been done.

I have just a little bit of space on the right-hand side in my right column to customize as well. But that is how you can fine tune your div tags, using both pattern and margin, and border. Now that we have it set up, we can remove it. Our page is looking pretty nice.

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