4.1 CSS syntax

CSS code consists of one or more rules.

Each CSS rule consists of a selector and, within brackets, one or more properties.

The selector specifies which HTML elements the rule applies to and the properties control the way that those HTML elements are displayed. An example of a CSS rule is shown below:

table { 
    border-width: thin;
    border-style: solid;
}

The code table is the selector and there are two properties, border-width and border-style, with values thin and solid, respectively.



Paul Murrell

Creative Commons License
This document is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.