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

CSS: Page Layouts
Illustration by

Using the Firebug Inspector and the WebKit Web Inspector


From:

CSS: Page Layouts

with James Williamson

Video: Using the Firebug Inspector and the WebKit Web Inspector

Now that we've seen how to access a browser's web debugging tools, let's experiment with using them to troubleshoot our CSS and refine our page layout. Now, for this exercise, we're going to focus on using the two most popular web debugging tools, Web Inspector and Firebug, as a way of getting more comfortable with using the tools, but don't be afraid to use Dragonfly or Microsoft's tools, whichever browser that you're going to be using most frequently, and really should be comfortable with using all of these tools. Okay, so I have index.htm opened up here from the 01_11 folder, and the first thing I'm going to do is I'm just going to preview this in Firefox.
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

Using the Firebug Inspector and the WebKit Web Inspector

Now that we've seen how to access a browser's web debugging tools, let's experiment with using them to troubleshoot our CSS and refine our page layout. Now, for this exercise, we're going to focus on using the two most popular web debugging tools, Web Inspector and Firebug, as a way of getting more comfortable with using the tools, but don't be afraid to use Dragonfly or Microsoft's tools, whichever browser that you're going to be using most frequently, and really should be comfortable with using all of these tools. Okay, so I have index.htm opened up here from the 01_11 folder, and the first thing I'm going to do is I'm just going to preview this in Firefox.

So, this is very common. We work on a page for a while, we save it, we test it, we preview it in the browser, and we see something that doesn't exactly look the way that it's supposed to. And in a lot of cases, we have to sort of guess why or go back in our code and figure something out. In this case, I want to use is browser debugging tools to help me figure out what's going on here. So, what's happening is this banner headline right here, We love urban photography, does not look the way that it should. We should see slightly a little bit more letter spacing and that should be all caps rather than mixed caps. So, I'm not really sure what went wrong here, so I'm going to turn on Firebug and see if it can help me with this.

So, I'm going to go right up here and turn the Firebug console on, and again just to sort of refresh your memory about Firebug, we have these different tabs which we can look at: the HTML; we can look at the CSS; we can look at any scripts that are going on; we have console view, that sort of thing. I want to focus on the HTML right now because notice that one of the things you can do is you can just sort of parse through your code and you'll see a preview of the element and you'll actually see some of the box model properties. Purple is padding, yellow margin, and then the blue that you're seeing that's the actual content itself. And we can go through and inspect any part of our code that we want.

We can open up our code structure. We can look inside these various elements, so we can really inspect all the things we want to. All right! So, going back to our banner here, we also have this little tool right here that says, "Click an element on the page to inspect." So, if I grab that, I can just sort of mouse around, visually grab the element that I want. That's going to focus on that within my code. Okay, if I look over here on the right- hand side of the Style panel, I can see the computed styles for this element. Well, the computed styles aren't what I expect them to be. Color, font-size, and padding-top, they're exactly what I expect them to be, but I'm missing a couple of properties.

I'm missing my letterspace property and I'm missing my text transform property. Now, there are a couple of things that I can do here. One of the things, for example is, I can go to the console. So, if I go over to the console and I run my warnings--now sometimes you have to refresh the page in order for this to cycle through again-- I notice that right at the very top of this it says, "Expected end of value but found ':' Error and parsing value for 'letter-spacing'. Declaration dropped." Now, it does tell me this happens on line 285, but it doesn't tell me exactly which selector this belongs to. I happen to know for a fact it belongs to the one we're looking at, but if you didn't know that, you'd still be kind of almost needle-in-a-hay-stacking this, but it does tell me that something is going on wrong here.

For example, that colon there, when it's expecting a semicolon, that's going to cause some parsing errors in my CSS. So I kind of guess that that's one of those issues. Now, there aren't that many differences between WebKit's Web Inspector and Firebug, but this is one of the bigger differences. The fact that here it's just showing me the computed styles. It's not showing me all of the properties that are actually in the CSS. It's showing just the finished computed styles. So, I want to go over to Chrome for a moment and show you kind of what happens when I look at the same element in Chrome. So, if I go right over here and I view and inspect the element for that banner headline, I get a slightly different view.

You can still parse through all the elements in the code. You still get your visual aids, but the colors are slightly different here in Chrome--or Web Inspector I should say because it looks exactly the same as Safari. We have sort of that orange color for margins. We have sort of that green color for padding. And again if we inspect an element-- here's the inspect element tool here in Web Inspector-- one of the things that Web Inspector does for us that I really like that Firebug doesn't is it gives me those CSS properties, that sort of visualization, as well as computed values as I move through the elements. So, that's really kind of nice.

Okay, but back to the task at hand. Here, I see something very different. When I look over here in the Styles pane, I can see that letter-spacing has a strike through and if I hover over this, I can see that I've got a little warning message here, and then my text transform is not applying at all. So, it's just basically parsing this as one big, huge error. So, I can tell that that's a problem. Another thing that showing all of these properties does for me is it helps me catch other types of mistakes as well. Let me show you what I mean. Now, I've got a couple of choices when inspecting elements.

One, I can come through and use the Inspect Element tool and just click on elements. I can do it that way, or I can come directly down here in the code and really sort of target exactly the element I'm looking for. Now, when I click on this heading 1 that's in the header, if I look over here in my Styles, I notice there's a strikethrough with this line-height and if I look at that, the line-height is set to 100 pixels, but there's another line-height declaration down here at 165. Now, the likely culprit here is when I was authoring the styles I probably tried the line-height at 100 pixels and didn't like it and added the line-height: 165 property to the end instead of modifying it, for whatever reason, who knows, I just forgot to go back and remove the initial line-height.

Now, what I really like about this in WebKit Inspector is well, notice it tells me this is on main.css line 185. So, very quickly and very easily, using both Firebug and Web Inspector, I found two errors in my CSS that I need to address. So, I'm going to switch back into Aptana Studio, go back into my code, and I'm going to fix those things. So, I'm going to open up, from the CSS folder here in 01_11, I'm going to open up main.css, and using the information that I got, I'm going to scroll down to around line 185.

Here we go. And I realize I don't need that line-height declaration, so I'm going to get rid of that. And then down around line 280 or so, 279 now, I can find that banner h1 rule, and here's the error, right there. So, instead of a colon, that is supposed to be a semicolon, so I'm going to change that and save it, and now I'm going to go back into my browsers and I'll refresh the page. Now, notice the change in the visual. So, we now have our text-transform is working, the letter-spacing is working, everything is happening there. And in Firefox if I look over here in Firebug, now I'm actually seeing those values.

There's the text-transform. There's the letter-spacing. I wasn't seeing that before. If I go over to Web Inspector and refresh the page, I see similar results. And if I focus on that element, I can see that those properties no longer have a strikethrough. So, we've seen how we can use Web Inspector and Firebug to debug some of our CSS, but what if you just want to sort of play around with it? What if you want to manipulate it and really see almost immediately the visual impact that you're going to have on your code? Well, that's pretty easy to do as well.

So, here I am, in Web Inspector, and one of things I want to do is I want to focus again on our heading here. So, again I can do this through HTML code, I can find this and click on it, or I could just inspect it directly on the page. Now, I've got more than just styles and computed styles available to me over here. If I come over, I have this Metrics pane, and this Metrics pane is giving me the box model properties of that particular element. You'll notice, for example, if I hover over a border, nothing shows up, margin nothing shows up. It indicates those properties don't exist for that particular element. But if I go over padding, I can visually see it; if I go over to the computed width and height, I can see that as well.

Now what's really nice about this is let's say I want to change that padding value. I can actually click right here, double-click the value, I can use arrows to go up or down and I can visually see that happen. Or I can even type in a value. Let's say I go down to say 230 and hit Return. I can kind of see what effect that's going to have on that headline, and whether I like it a little bit further down or not. Now, I'm going to switch back over to Firebug and show you pretty much how the same thing is done. So, they all have the same tools for the most part; they're just in slightly different locations. All right! Let me resize the Firebug pane here for a minute and center on our headline here.

All right! So, if I go over in this point to the Layout tab, now I really like this in Firebug. This is nice because again we get the same functionality. If we mouse over to different properties, you're going to be shown those properties. Let me zoom up a little bit so we can sort of see the padding there. There we go. But we also, in Firebug, get rulers. You can see the rulers show up on the browser now. I'm getting guidelines to show me where this is lining up. And again I can use my arrows to nudge this. I can type in a value. Let's say I type in 290 this time, and you know what? At 290, I kind of like that, and I like that a lot.

So, I might go ahead and decide to use that in my own CSS. So, if I switch back to Style and my computed style for this, you'll notice that what it did is it put the sort of in-line style directly in my HTML. Now, it's not modifying the HTML on your hard drive, or even on your server; it's just modifying this particular instance. Okay, so I like that value of 290. Now, if I want to play around the way things look, I can also edit my styles directly in this window. And I can do this in WebKit Inspector or Firebug, and in this case I'm just going to show you this in Firebug.

Notice I can click to create a new line here, and I can experiment. I can say okay, well, what if I put a border on the bottom of this and I did just a 1-pixel solid white border? And now I can preview what that looks like. I can toggle that on and off to see if I like it or not, and I can decide whether or not that particular property is for me. Now, anytime, if I add these properties, I could just go ahead and highlight those and I could copy and paste all those properties directly into my page.

So, if that's what I decided to go with, I can simply copy and paste them. I can even create brand-new rules here in Firebug or Web Inspector. So, you could even author CSS directly in the browser and then copy and paste them into your code. So, if I go back into my CSS, notice that I can come right here in the padding-top, I can go ahead and plug in that 290-pixel value that I liked so much. I can go back into my page. I can refresh that, and I can see the change that I made here in the browser. The visualization of that that I like is made.

So, I know this is a brief introduction, but it should five you some idea of exactly how powerful these tools are. Now, taking advantage of them just makes sense to you as a designer because think about it. In a sense you're working directly in the browser. Now that means that you're testing it in the rendering environment that you're eventually targeting, and it just doesn't get any better than that. Now, I'm sure that by now you've realized these tools offer far more in the way of functionality than just CSS. They can help you author and debug your HTML, they feature a JavaScript console that helps you test and debug your code, and they have a full range of tools to help you understand page loading, resource management, and a lot more.

So, in that sense, regardless of which editor you're using to write your HTML and CSS, be sure to take full advantage of these powerful tools as you begin to develop your sites.

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.