12
CSS Structure and Syntax
In This Chapter
Using selectors and declarations
Creating style rules
Discovering CSS properties
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:
Selector: Specifies the markup element to which style rules apply
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 ...
Get Beginning HTML5 and CSS3 For Dummies 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.