Syntax

The CSS syntax is made up of three parts: a selector, a property and a value. The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each property can take a value.

The property and value are separated by a colon and surrounded by curly braces. If the value is multiple words, put quotes around the value. If you wish to specify more than one property, you should separate each property with a semi-colon.

p {font-family: "sans serif"; text-align: center}

You can group selectors. Separate each selector with a comma.

h1, h2 {font-family: "Arial Black";}

With the class selector you can define a specific styles for all HTML elements with that class.

.caption {font-weight: bold;}

With the id selector you can define a specific style for one specific element:

#first {color: blue;}

All selectors can be combined:

p.caption#first {font-size: 150%;}