04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Time for the absolute test drive<br />

Make sure you’ve saved the new <strong>CSS</strong> and then reload<br />

“index.html” in your browser. Let’s check out the results:<br />

Wow, this looks amazingly<br />

like the float version;<br />

however, you know that<br />

the sidebar is being<br />

positioned absolutely.<br />

The main content area has<br />

a margin that is exactly<br />

the width of the sidebar,<br />

and the sidebar sits on top<br />

of that space.<br />

layout and positioning<br />

As you resize the<br />

browser, the sidebar<br />

always sits 128 pixels<br />

from the top, and sticks<br />

to the right of the page.<br />

And the sidebar has a 10<br />

pixel right margin, so it<br />

has spacing between it and<br />

the edge of the page.<br />

And we’ve still got a<br />

nice gutter between<br />

the two columns.<br />

But we are now back to having a problem <strong>with</strong> the<br />

footer. When the browser gets wide enough, the<br />

absolutely positioned sidebar comes down over the top<br />

of the footer. Unfortunately, we can’t fall back on the<br />

clear property this time, because flowed elements<br />

ignore the presence of absolutely positioned elements.<br />

When the browser is wide, the<br />

vertical space of the main<br />

content area is reduced, and<br />

the sidebar can come down over<br />

the footer.<br />

you are here 525

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!