专注优质Wordpress企业网站搭建与优化

花开有声:CSS rule Structure – CSS规则结构图例若干



Here is an example of a CSS rule:

  1. 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.

CSS rule Structure - CSS规则结构图例若干 - 西米CC

CSS rule Structure - CSS规则结构图例若干

SEO优化,CSS教程,Wordpress博客 - 来自西米CC

CSS rule Structure - CSS规则结构图例若干

[ 以下内容您也可能感兴趣 ]

Add a Comment