It’s no exaggeration to say that modern web design wouldn’t be possible without CSS, the Cascading Style Sheet standard. CSS allows even the most richly formatted, graphically complex web pages to outsource the formatting work to a separate document—a style sheet. This keeps the web page markup clean, clear, and readable.
To get the most out of HTML5 (and this book), you need to be familiar with the CSS standard. If you’re a CSS pro, don’t worry about this appendix—carry on with the material in the rest of the book, and pay special attention to Chapters Chapter 6 and Chapter 7, which introduce many of the new style features that CSS3 adds. But if your CSS skills are a bit rusty, this appendix will help to refresh your memory before you go any further.
This appendix gives a very quick (and not comprehensive) rundown of CSS. If you’re still overwhelmed, consult a book that deals with CSS in more detail, like CSS3: The Missing Manual by David Sawyer McFarland.
There are three ways to use styles in a web page.
The first approach is to embed style information directly into an element using the
style attribute. Here’s an example that changes the color of a heading:
style="color: green">Inline Styles are Sloppy Styles</h1>
This is convenient, but it clutters the markup terribly. You have to style every line, one by one.
The second approach is to embed an entire style sheet in a
<style> element, which you must place in the page’s