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.

getting more sophisticated <strong>with</strong> selectors<br />

We have the technology: specifying a<br />

second rule, just for the <br />

We don’t have to split the “h1, h2” rule up, we just need to add another<br />

rule that is only for “h1” and add the border style to it.<br />

h1, h2 {<br />

font-family: sans-serif;<br />

color: gray;<br />

}<br />

h1 {<br />

border-bottom: 1px solid black;<br />

}<br />

p {<br />

}<br />

296 Chapter 8<br />

color: maroon;<br />

Another test drive...<br />

Change your <strong>CSS</strong> and reload the page. You’ll see that the new rule<br />

added a black border to the bottom of the main heading, which gives<br />

us a nice underline on the heading and really makes it stand out.<br />

Here’s the bottom<br />

border in black.<br />

And no border<br />

here, just what we<br />

wanted.<br />

The first rule stays the same. We’re<br />

still going to use a combined rule<br />

for the font-family and color for<br />

both and .<br />

But now we’re adding a second rule<br />

that adds another property just to<br />

: the border-bottom property.

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

Saved successfully!

Ooh no, something went wrong!