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 Chapter 8, which introduces the new style features that are being added to CSS3. 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 CSS: The Missing Manual.
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
This is convenient, but it clutters the markup terribly.
The second approach is to embed an entire style sheet in a <style> element, which you must place in the <head> section of your page:
<title>Embedded Style Sheet Test