Common Selector)
Element/type selector: P, H1, A {color: #444; padding: 3px ;}
Descendant selectors (descendant Selection Sub-) Li a {color: #444;} This style is only valid for a under Li. These two representation methods are generally used to set a style for the elements on the entire page.
Class and ID are used when only some styles are set. The class can be used by any number of elements. The ID is generally only for a specific element and is unique throughout the page.
Id selector: Start With # id_name {color: #444}
Class selector: starts with a. Number. class_name {color: #444}
Type descendant ID/class selector, # id_name Li {color: #444} can be combined }. class_name Li {color: #444}, # id_name. class_name {color: #444 }. this writing method is similar to the reference of objects in the object-oriented method.
In addition to static CSS Styles, you can also apply different styles Based on the object state, called the pseudo-class
/* Makes all visited links green */
A: visited {color: green ;}
/* Makes links red when hovered or activated */
A: hover, A: active {color: red ;}
Universal selector (Global Selection Sub)
* {Color: #44} is applied to all elements in the document.
Advanced Selection Sub-
Currently, IE6 does not support this function. You can set a CSS style for an attribute of element, or even set a style based on the attribute value.
Http://css.maxdesign.com.au/floatutorial/index.htm