CSS – Syntax

The basic syntax that that you can use to apply CSS to any website. CSS syntax consists of a set of rules. These rules have 3 parts: a selector, a property, and a value.

Grouping Selectors
Apply a style to many selectors if you like. Just separate the selectors with a comma.

h1,h2,h3,h4,h5,h6 { color: red }

Uses Multiple Properties
Apply more than one property separate each declaration with a semi-colon.

h1 { color:red; font-family:verdana,"sans serif" }

CSS code more readable by spreading your style declarations across multiple lines.

h1 {
	font-family:verdana,"sans serif";
Posted in CSS

Leave a Comment