CSS selector (Select Sub) Format

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.