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.

One tradeoff you can make to fix the footer<br />

To try this solution, just give the footer the same right margin size<br />

as the main content area, like this:<br />

#footer {<br />

background-color: #675c47;<br />

color: #efe5d0;<br />

text-align: center;<br />

padding: 15px;<br />

margin: 10px 330px 10px 10px;<br />

font-size: 90%;<br />

}<br />

If you save this and reload your page, you’ll see that the footer is<br />

now under the main content area only, and never creeps up under<br />

the sidebar. Is this optimal? No, but it’s also not bad. And, as we’ve<br />

said, doing <strong>CSS</strong> layout is a bit of an art. To do layout, you need<br />

to experiment, explore, and keep an eye on the layouts others are<br />

creating <strong>with</strong> <strong>CSS</strong> (you’ll find some references for good <strong>CSS</strong> hangouts<br />

at the end of the chapter).<br />

So this is all great,<br />

but what am I supposed<br />

to do? Use a liquid or jello<br />

design? Use float or absolute<br />

positioning?<br />

layout and positioning<br />

This solution trades having the footer<br />

under just the main content for having a<br />

footer under the entire page, to keep it<br />

from creeping up under the sidebar.<br />

In terms of whether you want your layout to be liquid or frozen or<br />

jello, that really is a matter of deciding what works best for your<br />

pages. For some pages, a fixed content area size <strong>with</strong> expandable<br />

margins works great, and in fact can be more readable on wide<br />

browsers. For other uses, you might want to use as much of the<br />

browser as you can. So, decide what works best for you.<br />

Once you’ve decided, you still need to figure out which method<br />

you’re going to use to create your pages (float? absolute? some<br />

combination?). You’ve already learned the basics, so now it is<br />

time to start exploring, as there are many other approaches out<br />

there, and new ones being created every day. The techniques<br />

you’ve learned in this chapter are often used as the basis for more<br />

sophisticated designs.<br />

You should know that, in general, using float is considered the<br />

most flexible solution for multi-column layouts. Just keep in<br />

mind, you may have to be careful in the order of your content,<br />

depending on the design.<br />

you are here 527

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

Saved successfully!

Ooh no, something went wrong!