You are previewing Stylin’ with CSS: A Designer’s Guide, Third Edition.

Stylin’ with CSS: A Designer’s Guide, Third Edition

Cover of Stylin’ with CSS: A Designer’s Guide, Third Edition by Charles Wyke-Smith Published by New Riders
O'Reilly logo

Chapter 2. How CSS Works

You saw in Chapter 1 how the structure of a document is created with HTML. In this chapter, I will show you how CSS rules are used to style HTML, and explain the workings of the Cascade, which is how CSS resolves which style is applied when more than one style affects an element property.

Each HTML element has style properties that can be set with CSS. These properties relate to the different visual aspects of the element, such as its position onscreen, the width of its border, the size, color, and fonts of its text, and so on. CSS is a mechanism for selecting HTML elements and then setting the selected elements’ CSS properties. Each CSS selection and the associated styles that are applied is called a CSS rule.

This ...

The best content for your career. Discover unlimited learning on demand for around $1/day.