CSS Syntax and rule

CSS Syntax and Rules.

The CSS declaration.

  • You specify this as a property followed by a colon, where the property can be for instance a color, a margin-left or a background-color. Then you must specify the value that is related to the property. It all ends with a semicolon.
    property: value;

The CSS Rule.

  • The purpose of a CSS rule is that it can be used several times by your html elements in one or more web pages.
  • A rule has two fundamental parts, the selector and the declaration block. The declaration block is composed of one or more CSS declarations, and each CSS declaration is a pairing of a property and a value.
    selector {property: value; property: value; ..... }
    The selector defines which piece of the HTML document that will be affected of the rule. The following session will explain the details about the selector, properties and values.

© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.