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.

how to use spans<br />

Adding s in three easy steps<br />

elements give you a way to logically separate inline content in the same<br />

way that s allow you to create logical separation for block level content. To<br />

see how this works, we’re going to style the music recommendations by first adding<br />

elements around the CDs and artists, and then we’ll write two <strong>CSS</strong> rules<br />

to style the s. Here’s exactly what you’re going to do:<br />

1<br />

2<br />

You’re going to nest the CDs and artists in separate elements.<br />

You’re going to add one to the “cd” class and the<br />

other to the “artist” class.<br />

3 You’re going to create a rule to style the “cd” class <strong>with</strong> italic, and<br />

464 Chapter 11<br />

the “artist” class <strong>with</strong> bold.<br />

Steps one and two: adding the s<br />

Open your “lounge.html” file and locate the “Who’s playing at the Lounge”<br />

heading. Just below that you’ll see the unordered list of recommendations.<br />

Here’s what it looks like:<br />

Each list item consists of a CD title, a<br />

comma, and then the music artist.<br />

<br />

Buddha Bar, Claude Challe<br />

When It Falls, Zero 7<br />

Earth 7, L.T.J. Bukem<br />

Le Roi Est Mort, Vive Le Roi!, Enigma<br />

Music for Airports, Brian Eno<br />

<br />

Let’s try adding s to the first CD and artist:<br />

Just add a opening tag along <strong>with</strong><br />

the class attribute and a value of “cd”.<br />

Next, add a closing tag<br />

after the CD title.<br />

Do the same for the artist. Nest it<br />

in a element, only this time<br />

put the in the “artist” class.<br />

<br />

Buddha Bar, Claude Challe<br />

When It Falls, Zero 7<br />

Earth 7, L.T.J. Bukem<br />

Le Roi Est Mort, Vive Le Roi!, Enigma<br />

Music for Airports, Brian Eno<br />

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

Saved successfully!

Ooh no, something went wrong!