Web Design

(Nancy Kaufman) #1

133


CHAPTER

Advanced CSS 5


TIP


What is the difference between <div> and <span>?
The <span> tag is an inline element, meaning that it should only be used to wrap around pieces of text
already contained within some other element, such as a paragraph or heading. The <div> tag, on the other
hand, is a block-level element, so it should be used to wrap around those bigger elements. If you want to
style a group of words in a paragraph, use <span>. If you want to style a group of paragraphs, use <div>.

● When the page is viewed in
the browser, the elements
wrapped within the div have
the specified styles applied
to them.

4 Within the style sheet, type
div.


5 Press.


6 Type {.


7 Type one or more style rules.


8 Press.


9 Type }.


6


9


4


7

Free download pdf