04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Exercise<br />

Solutions<br />

Sharpen your pencil<br />

Solution<br />

Move the elixirs back to its original place below the music<br />

recommendations, then save and reload the page. Where does the<br />

element get floated now? You should have seen the elixirs below the music<br />

recommendations.<br />

The is floated<br />

to the right, just<br />

below the music<br />

recommendations, and<br />

the remainder of the<br />

X<strong>HTML</strong> is floated<br />

around it (which is just<br />

the footer).<br />

layout and positioning<br />

What we want to do is set a right margin on the main content section so that it’s<br />

the same width as the sidebar. But how big is the sidebar? Well, we hope you<br />

aren’t already rusty since the last chapter. Here’s all the information you need to<br />

compute the width of the sidebar. And here’s the solution.<br />

#sidebar {<br />

background: #efe5d0 url(images/background.gif) bottom right;<br />

font-size: 105%;<br />

padding: 15px;<br />

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

width: 280px;<br />

float: right;<br />

}<br />

15 + 15 + 280 + 0 + 0 + 10 + 10 = 330<br />

left padding<br />

right padding<br />

content area<br />

left border<br />

right border<br />

right margin<br />

left margin<br />

you are here 545

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

Saved successfully!

Ooh no, something went wrong!