h1, p {color:#000000;background:#ffffff}
A CSS rule consists of two parts - the selector and the declaration block. The selector comes first and can be any (X)HTML tag, a class, an id, a pseudo-class, a pseudo-element, the universal selector, or an attribute selector . There can be more than one selector - there are various ways in which selectors can be used together.
Next comes the declaration block which starts with the left brace { and ends with the right brace }. The declaration block contains one or more declarations. A declaration consists of a property followed by a colon which is followed by a value. If there are no more declarations following a particular declaration, then it should end with a semi-colon. The last declaration is followed by the right brace; the semi-colon is optional.
A property is a word that refers to a formatting effect. For example color is a property.
A value describes the formatting that has to be applied to the selector. The value can be a color value, a number value, a length value, a percentage value or a URL.
Note that spaces,tab characters,carriage returns, line feeds and form feeds are considered whitespace and are ignored anywhere except within selectors, properties and values.
No comments:
Post a Comment