Web Design

(Nancy Kaufman) #1

131


CHAPTER

Advanced CSS 5


How can I style different pieces of text
differently?
You can wrap any text with the <span> tag. CSS
provides for two special selectors — classes and
IDs — that allow you to apply different styles to
the individual instances of the same element. These
two selectors are covered later in this chapter.

What happens if I add a <span> tag to my page
but do not apply a style to it?
The <span> has no default formatting, so adding
one to your page without a corresponding style does
not affect the page’s appearance at all. The <span>
tag was specifically added to HTML as a way of
applying styles where no other tag existed.

● When the page is viewed
in the browser, the text
wrapped within the span
has the specified styles
applied to it.

4 Within the style sheet, type
span.


5 Press.


6 Type {.


7 Type one or more style rules.


8 Press.


9 Type }.


4


7


6


9


TIPS

Free download pdf