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

CSS: Page Layouts
Illustration by

Floats: Lab


From:

CSS: Page Layouts

with James Williamson

Video: Floats: Lab

Welcome to your first lab. Now in our labs you get to put what you've learned up till this point to the test. They are little different than regular exercise files, because instead of me giving you step-by-step instructions, I am going to give you the overall goals for the project, and then it's up to you to decide how to solve the problems that I give you. After you're done working on your lab, be sure to check the solutions movie that follows this one to compare your solutions to mine. So for our lab on floating, go into the 03_10 directory and open up the index.htm and the main.css file.
Expand all | Collapse all
  1. 4m 20s
    1. Welcome
      54s
    2. How to use the exercise files
      3m 26s
  2. 1h 39m
    1. Box model review
      8m 47s
    2. Calculating element dimensions
      11m 11s
    3. Understanding margin collapse
      7m 59s
    4. Calculating em values
      7m 41s
    5. Calculating percentage values
      7m 51s
    6. Normal document flow
      13m 3s
    7. Controlling element display
      8m 53s
    8. Using CSS Resets
      7m 11s
    9. Fixed, fluid, and responsive layouts
      9m 9s
    10. CSS debugging tools
      6m 46s
    11. Using the Firebug Inspector and the WebKit Web Inspector
      11m 5s
  3. 53m 15s
    1. Page design workflow
      3m 6s
    2. Page design tools
      4m 56s
    3. Determining page structure
      7m 18s
    4. Creating image assets
      8m 58s
    5. Creating initial page structure
      7m 3s
    6. Adding meaning with classes and IDs
      5m 23s
    7. Structuring content with HTML5
      6m 6s
    8. Building internal structure
      10m 25s
  4. 1h 36m
    1. Floating elements
      7m 50s
    2. Clearing floats
      7m 28s
    3. Containing floats
      7m 50s
    4. Clearfix technique
      10m 38s
    5. Floating inline elements
      14m 34s
    6. Two-column floated layouts
      8m 17s
    7. Three-column floated layouts
      11m 30s
    8. Column height considerations
      7m 3s
    9. Creating equal-height columns
      10m 42s
    10. Floats: Lab
      5m 25s
    11. Floats: Solution
      5m 21s
  5. 51m 42s
    1. Relative positioning
      7m 59s
    2. Absolute positioning
      8m 59s
    3. Fixed positioning
      4m 23s
    4. Controlling stacking order
      8m 31s
    5. Clipping content
      8m 21s
    6. Controlling content overflow
      5m 38s
    7. Positioning elements: Lab
      3m 59s
    8. Positioning elements: Solution
      3m 52s
  6. 48m 46s
    1. Design considerations for fixed layouts
      3m 28s
    2. Establishing the layout grid
      7m 57s
    3. Defining column spacing
      9m 30s
    4. Applying the grid through CSS
      8m 56s
    5. Creating grid-based assets
      8m 26s
    6. Grid design resources
      6m 22s
    7. Building fixed layouts: Lab
      4m 7s
  7. 44m 35s
    1. Designing for flexible layouts
      2m 30s
    2. Calculating percentage values
      8m 45s
    3. Setting flexible width values
      6m 6s
    4. Making images flexible
      8m 10s
    5. Setting minimum and maximum widths
      7m 24s
    6. Building flexible layouts: Lab
      4m 53s
    7. Building flexible layouts: Solution
      6m 47s
  8. 49m 36s
    1. Responsive layout overview
      3m 49s
    2. Using media queries
      7m 16s
    3. Organizing styles
      8m 39s
    4. Making content responsive
      8m 33s
    5. Mobile design considerations
      7m 32s
    6. Building responsive layouts: Lab
      4m 23s
    7. Building responsive layouts: Solution
      9m 24s
  9. 1h 22m
    1. Creating multi-column text
      6m 36s
    2. Using borders to enhance design
      13m 59s
    3. Rounding corners
      6m 56s
    4. Adding drop shadows
      10m 35s
    5. Working with opacity
      6m 8s
    6. Utilizing the background property
      15m 5s
    7. Working with CSS sprites
      7m 58s
    8. Enhancing page design: Lab
      6m 22s
    9. Enhancing page design: Solution
      8m 38s
  10. 6m 25s
    1. Additional resources
      6m 25s

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 ...
CSS: Page Layouts
8h 57m Beginner Feb 07, 2012

Viewers: in countries Watching now:

CSS: Page Layouts introduces basic layout concepts, gives advice on how to create properly structured HTML based on prototypes and mockups, and goes into critical page layout skills such as floats and positioning. Author James Williamson shows how to combine these techniques to create fixed, fluid, and responsive layouts. Designers are also shown how to enhance their pages through the creative use of CSS techniques like multi-column text, opacity, and the background property. Exercise files are included with this course.

Topics include:
  • Reviewing the box model
  • Calculating em and percentage values
  • Controlling how elements display
  • Creating fixed, fluid, and responsive layouts
  • Structuring content with HTML5
  • Floating elements
  • Using relative, absolute, or fixed positioning
  • Defining column spacing
  • Creating grid-based assets and layouts
  • Considering mobile-design-specific issues
  • Working with multi-column text
  • Enhancing page design CSS Sprites
Subjects:
Web Web Design
Software:
CSS
Author:
James Williamson

Floats: Lab

Welcome to your first lab. Now in our labs you get to put what you've learned up till this point to the test. They are little different than regular exercise files, because instead of me giving you step-by-step instructions, I am going to give you the overall goals for the project, and then it's up to you to decide how to solve the problems that I give you. After you're done working on your lab, be sure to check the solutions movie that follows this one to compare your solutions to mine. So for our lab on floating, go into the 03_10 directory and open up the index.htm and the main.css file.

Now I want to preview this page in a browser and I am going to compare it to the finished version so you can see kind of what our goals are. So here's the page in its current state. If I scroll down, after the banner some things start to appear maybe not the way we want. We are still in a single-column layout. We've got these two boxes that are stacked vertically. Our Archived Galleries list is way too wide. So obviously here our layout is in a single column instead of the two-column layout that we are shooting for. If we look at the finished version of the file, if I scroll down, you can see that this content is now in a column on the left-hand side, our Archive Galleries are a column on the right-hand side.

They look a lot narrower. They look a lot better like that. These two boxes are stacked horizontally now, and then there are our page footer. So that is what we are shooting for. Now I am going to go back into the code and talk about what explicitly we are going to need to do. Okay, so I am going to focus on the main.css file. At the very top of the CSS file, I have in a comment the goals of your lab, so as you're working through the lab, feel free to go back up to these and take a look at all of your goals in order. Now I am just going to go down through the code and sort of show you, in the code, where you are going to be writing certain selectors and which selectors you are going to need to modify to achieve what we want.

All right, so I am going to go down to about right around line 160 or so. I have got a section on the styles right here that says, "Basic layout styles." Currently right now there are only two selectors in there, so we are going to have to add some stuff to this. Now the first thing that you need to do is you are going to need to write a selector for the body that's going to set the overall width of the page to 1280 pixels, and then you are going to need to use that selector to center the entire layout. Go back through. We didn't have a specific movie on centering, but in many of the movies in this chapter, I talked about using a technique with margins to center content on the page, so that's kind of what we are going for there.

Now the next thing we will need to do is write a selector for the article tag, or the article element, that makes it the left column in our two-column layout. You need to give it 50 pixels' worth of space on the left-hand side, and it should take up a total of 900 pixels' worth of space. Now after you are done with the article, write a selector for the aside that makes it the right-hand column in our two-column layout. Now for it, it will need 50 pixels' worth of space on the right-hand side, and then I want its total width that when it's added to the left-hand column, leaves you with 50 pixels' worth of space between the columns.

So you are going to have to do a little math here. Think about this. Your left-hand column is going to take up a total of 900 pixels' worth of space. Your page all total is 1280 pixels wide, so essentially, the right-hand column will need to have 50 pixels' worth of space on the right-hand side and then 50 pixels' worth of space between the left and the right-hand column. And you are going to need to decide exactly how wide that's going to need to be. The last thing here that I'll need you to do is the page footer. We want to ensure that the page footer always remains below our two columns, so you are going to need to modify that selector so that that occurs.

Now I am going to scroll down to right around line 332 or so, there we go, and find the news selector. So this is those two boxes that are stacking currently right now, vertically on top of each other, but in the finished version, they are stacked horizontally. That's what we need to take care of. So we are going to modify the news selector so that the two news items are going to appear horizontally. We are going to use margins to separate the two so that there is 50 pixels' worth of space between them. Here's the tricky part though.

You've got to make sure the spacing only appears between the two news items and doesn't create additional spacing on either side. Now what I mean by that is if you were to go ahead and apply just margin right to both of them, then you end up with instead of just 50 pixels between the two of them, you've got another 50 pixels on the other side. So you've got to figure out how to solve that. That could require an extra selector. Maybe you could do it with just a selector, but you might have to write an additional selector as well, and that's something that you're just going to have to really put on your thinking cap about and try to solve that particular problem.

My advice is to take a moment before you start this, look through the HTML and the CSS--I know there's a lot of code here--and get familiar with the elements that you are going to be controlling. It's always more difficult to modify somebody else's style sheet rather than your own, so I realize I'm putting you in the middle of a difficult situation here. So think about how you can use floating to achieve the goals that I just talked about, and then carefully plan on how you are going to use padding and margins to achieve the desired spacing in your elements as well. So you should use padding in this instance. You should use margin; that's something you are really going to do need to think about.

Now as I've stated throughout the chapter, there's going to be multiple ways to create the desired layout using floats, so don't get too caught up in trying to guess exactly how I did it. Simply decide for yourself what the most efficient way is to solve the problems that I have given you. Have fun!

There are currently no FAQs about CSS: Page Layouts.

 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

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.

join now 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 CSS: Page Layouts.

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


OK
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
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.

Are you sure you want to delete this note?

No

Notes cannot be added for locked videos.

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
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.