Appendix C. CSS basics

If you’ve just read appendix B, you’re probably wondering how those rather dull textual examples end up looking like the beautiful web pages you see every day. The answer isn’t some secret extra markup you didn’t learn about yet, but Cascading Style Sheets (CSS). This appendix will introduce the main features of CSS, including

  • The basic syntax of CSS
  • Using CSS selectors to apply styles only to certain elements
  • The most common properties and values
  • Using CSS for layout

Rules, selectors, properties, and values

A CSS style sheet is made up of rules. Here are three example CSS rules.

A CSS rule is made up of a selector ...

Get Hello! HTML5 & CSS3: A user-friendly reference 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.