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.

Changing the color of the elixir headings<br />

Now that you know about descendant selectors, let’s set the heading to<br />

black and the headings to red in the elixirs. Here’s how you do that:<br />

#elixirs h2 {<br />

color: black;<br />

}<br />

#elixirs h3 {<br />

color: #d12c47;<br />

}<br />

A quick test drive...<br />

Go ahead and add these new properties to the bottom of your<br />

“lounge.css” file, save, and reload “lounge.html”.<br />

We’ve got black and red headings<br />

in the elixirs section, and we<br />

haven’t affected the aquamarine<br />

color being used for <br />

headings in the main page.<br />

Now all we need to do is<br />

fix the line height.<br />

Here we’re using the descendant<br />

selectors to target just the <br />

and elements in the elixirs .<br />

We’re setting to black, and <br />

to a red color, using a hex code.<br />

divs and spans<br />

you are here 455

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

Saved successfully!

Ooh no, something went wrong!