All CSS styles are made up of 3 parts: a selector, a property and a value. To keep in line with the XHTML formatting rules all CSS code should be written in lowercase.
p {property:value}.p {color:value}.p {color:red}.CSS statements can have more than one property:value pair by separating them with a semicolon ;.
Properties want you to provide at least one value but may sometimes accept more. Multiple values can either be space-separated which means that all values are used for the property. Or they can be comma-separated which means that a series of values is being suggested and the first applicable one is used.
Above CSS statement uses all 3 values to render paragraphs with a 5 pixel wide red border.
Above CSS statement suggests 3 fonts to be used for paragraphs, from left to right. In case Verdana is not available on the user's system it will try to use Arial and if that fails, too, it will resort to a generic sans-serif font.
Instead of writing the same CSS rule for every HTML tag you whish to apply it to, you can group selectors together and separate them by commas. This makes CSS code extremely compact & efficient.
If you just apply styles to a paragraph selector, all paragraphs will be affected. What if you wish to only change the paragraphs inside list items? In that case you need contextual selectors which only apply a CSS rule if a tag occurs in a certain context. A contextual selector is created by listing the tags in the nested order in which they should appear in your document.
In above example only paragraph elements <p> inside list items <li> get red text and only emphasized text <em> in <h1> headings gets a gray background.
Sometimes it can be helpful to put CSS comments next to some statements to explain what they're doing. These comments are ignored by web browsers but still add up to the final file size (unlike programming languages such as PHP, where comments aren't part of the final output).
All current major web browsers support both types of selectors so you can safely use them. There are some more advanced CSS selectors which are not all supported by browsers such as Internet Explorer (see a pattern here?). They will be covered in the CSS advanced tutorial.