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.

the box model<br />

A closer look at the box model<br />

You’re going to be able to control every aspect of the box <strong>with</strong><br />

<strong>CSS</strong>: the size of the padding around the content, whether or not<br />

the element has a border (as well as what kind and how large),<br />

and how much margin there is between your element and other<br />

elements. Let’s check out each part of the box and its role:<br />

What is the<br />

content area?<br />

Every element starts <strong>with</strong> some<br />

content, like text or an image,<br />

and this content is placed inside<br />

a box that is just big enough<br />

to contain it. Notice that the<br />

content area has no whitespace<br />

between the content and the<br />

edge of this box.<br />

What is the padding?<br />

Any box can have a layer of padding<br />

around the content area. Padding is<br />

optional, so you don’t have to have it,<br />

but you can use padding to create visual<br />

whitespace between the content and<br />

the border of the box. The padding<br />

is transparent and has no color or<br />

decoration of its own.<br />

392 Chapter 10<br />

We’ve drawn an edge<br />

around the content<br />

area just so you know<br />

how big it is. But in a<br />

browser there is never<br />

a visible edge around<br />

the content area.<br />

The content area holds the element’s<br />

content. It’s typically just big enough<br />

to hold the content.<br />

Our guarantee: at the lounge, we’re<br />

committed to providing you, our guest,<br />

<strong>with</strong> an exceptional experience every<br />

time you visit. Whether you’re just<br />

stopping by to check in on email over<br />

an elixir, or are here for an out-ofthe-ordinary<br />

dinner, you’ll find our<br />

knowledgeable service staff pay attention<br />

to every detail. If you’re not fully satisfied<br />

have a Blueberry Bliss Elixir on us.<br />

The browser adds optional padding around<br />

the content area.<br />

Using <strong>CSS</strong>, you’re going to be able to control the width of<br />

the padding around the entire content area, or even control<br />

the padding on any one side (top, right, bottom, or left).<br />

Our guarantee: at the lounge, we’re<br />

committed to providing you, our guest,<br />

<strong>with</strong> an exceptional experience every<br />

time you visit. Whether you’re just<br />

stopping by to check in on email over<br />

an elixir, or are here for an out-ofthe-ordinary<br />

dinner, you’ll find our<br />

knowledgeable service staff pay attention<br />

to every detail. If you’re not fully satisfied<br />

have a Blueberry Bliss Elixir on us.

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

Saved successfully!

Ooh no, something went wrong!