HTML and CSS Reference
In-Depth Information
I was thinking we could
just wrap <em> and <strong>
elements around the CDs and
artists. On most browsers, that's
going to give us italic and bold.
Frank:
Yeah, but that's kind of like using a
<blockquote>
just to
indent text. What I mean is that we don't really want to emphasize and
strongly emphasize the CD and artists. We just want italic and bold.
Plus, what if someone changes the style for
<em>
and
<strong>
? That
would show up on the CDs and artists too.
Jim:
Well, I actually thought about that, but I couldn't think of any
other way to do it. I mean, this is just text in the same list item. It's not
like we have any way to style it.
Frank:
What do you mean?
Jim:
We can only style elements, and here we just have a bit of text,
like, “Music for Airports, Brian Eno”. We'd need an element around
each piece of text to be able to style them differently.
Frank:
Oh, right, right. I see what you mean.
Jim:
I suppose we could use something like:
<div class="cd">
Music for Airports
</div>
<div class="artist">
Brian Eno
</div>
.
But that's a block element, so that is going to cause linebreaks.
Frank:
Ahhh, I think you're on to something, Jim. There's another
element like
<div>
that is for inline elements. It's called a
<span>
. That
could work out perfectly.
Jim:
I'm game. How does it work?
Frank:
Well, a
<span>
gives you a way to create a grouping of inline
characters and elements. Here, let's just give it a try…