Prev | Current Page 46 | Next

Charles Wyke-Smith

"Stylin' with CSS: A Designer's Guide 2nd Edition"


This chapter will teach you the mechanics of CSS, and by
the end of this chapter, you??™ll be ready to create your own
styles for the piece of sample XHTML markup we studied in
Chapter 1.
STYLIN??™ WITH CSS - CHAPTER 2 28
The Three Ways to Style Your Document
There are three ways to add CSS to your Web pages: inline, embedded,
and linked from a separate CSS style sheet. The only one that
really makes any sense in terms of developing Web sites is to link
your XHTML pages to a CSS style sheet, but we will examine the
other two as well, as they can be useful while creating your pages.
A style sheet can be linked to an in?¬? nite number of XHTML pages,
which helps ensure a consistent look from page to page and allows
edits made to a style to be instantly re?¬‚ ected across an entire site.
Inline Styles
Inline styles (also known as local styles) are added to a tag using the
XHTML style attribute, like this

This paragraph simply takes on the browser??™s default
paragraph style.


By adding inline CSS styling to this
paragraph, we can override the default styles.


And now we are back to a regular default paragraph without
any inline styles.


which looks like this (see Figure 2.1)
FIGURE 2.1 Inline styles are only
applied to the tag to which they are
attached.


Pages:
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58