2011年12月31日星期六

note of css

CSS Syntax

A CSS rule has two main parts: a selector, and one or more declarations:
The selector is normally the HTML element you want to style.
Each declaration consists of a property and a value.
The property is the style attribute you want to change. Each property has a value.
Do not leave spaces between the property value and the units!
A CSS declaration always ends with a semicolon, and declaration groups are surrounded by curly brackets:

A CSS comment begins with "/*", and ends with "*/", like this:

The id selector is used to specify a style for a single, unique element.

The id selector uses the id attribute of the HTML element, and is defined with a "#".

The class Selector

The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements.
The class selector uses the HTML class attribute, and is defined with a "."

There are three ways of inserting a style sheet:

    External style sheet
    Internal style sheet
    Inline style
   
 Cascading order

What style will be used when there is more than one style specified for an HTML element?

Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority:

    Browser default
    External style sheet
    Internal style sheet (in the head section)
    Inline style (inside an HTML element)


没有评论:

发表评论

WorldTimeServer Clock

New York

搜索此博客