3.4 SELECTORS

CSS rules (CSS Declarations) that are defined, are applied to individual HTML tags as per pattern matching rules. The patterns are defined in CSS as Selectors. They are many types of them, classified by their mode of application, that is, Styles that are defined are applied to a specific selection, identified by a Selector or group of Selectors. A simple selector is the Type Selector. For example, consider the following directive.

div {font-size: 1em;}

It matches all elements with <div> tag in the HTML form. After matching, it applies the style(s) indicated in the CSS Declaration block. In this case, a font size of 1 em is the style applied. This is the most straight-forward type of selector to understand. Now let us move on to ...

Get Web Technology: Theory and Practice 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.