Creating an Internal Style Sheet

Internal style sheets let you set the styles at the top of the (X)HTML document to which they should be applied. If you plan to apply the style sheet to more than one page, you’re better off using external style sheets (see page 128).

To create an internal style sheet:

1.
In the head section of your (X)HTML document, type <style type="text/css">.
2.
Define as many style rules as desired (see page 120).
3.
Type </style> to complete the internal style sheet (Figure 8.12).
Figure 8.12. The style element and its enclosed style rules go in the head section of your document. Don’t forget the closing </style> tag, as for some reason I am wont to do.

Figure 8.13. The result is exactly the same as if you linked ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.