O'Reilly logo

Beginning HTML5 and CSS3 For Dummies by Chris Minnick, Ed Tittel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12

CSS Structure and Syntax

In This Chapter

arrow Using selectors and declarations

arrow Creating style rules

arrow Discovering CSS properties

arrow Understanding inheritance and the style cascade

In this chapter, we talk about the rules, or syntax, of CSS. Once you understand how CSS goes about locating elements and applying styles to them, we’ll get into more details about the important topic of cascading. So far, we’ve only touched on the topic of cascading but it’s vital to understanding how to use CSS.

Exploring CSS Structure and Syntax

A style sheet is made of style rules. Each style rule has two parts:

check.png Selector: Specifies the markup element to which style rules apply

check.png Declaration: Specifies how content described by the markup looks

You use a set of punctuation marks and special characters to define a style rule. The syntax for a style rule always follows this pattern:

selector {declaration;}

A semicolon ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required