Introduction to delimiter Classification

Source: Internet
Author: User
Non-original, source network. Thanks to the original author for providing such wonderful articles. Original address: http://www.jluvip.com/blog/article.asp? Id = 186
Introduction to delimiter Classification

1. wildcard Selection
Syntax:

* { sRules } 

Note:
Wildcard character. Select all types of single objects in the document directory tree (DOM.
If the wildcard character is not the only component of a single character, "*" can be omitted.
Example:

*[lang=fr] { font-size:14px; width:120px; } 

*.div { text-decoration:none; }

2. Type Selector
Syntax:

E { sRules } 

Note:
Type selector. Take the document language object (element) type as the selector.
Example:

td { font-size:14px; width:120px; } 

a { text-decoration:none; }

3. Attribute Selector
Syntax:

E [ attr ] { sRules } 

E [ attr = value ] { sRules }

E [ attr ~= value ] { sRules }

E [ attr |= value ] { sRules }

Note:
Attribute selector.
Select e with the ATTR attribute
Select e with the ATTR attribute and the attribute value is equal to the value
Select a word list with the ATTR attribute and the attribute value is separated by spaces. One of the words is equal to the value of E. The value here cannot contain spaces
Select a word list that has the ATTR attribute and the attribute value is separated by a hyphen.
Example:

H [title] {color: Blue ;}

/* All h objects with the title attribute */

 

SPAN [class = demo] {color: red ;}

 

Div [speed = "fast"] [dorun = "no"] {color: red ;}

 

A [rel ~ = "Copyright"] {color: black ;}

4. Include the selector
Syntax:

E1 E2 { sRules }

Note:
Contains the selector. Select All E2 contained by E1. That is, e1.contains (E2) = true.
Example:

table td { font-size:14px; } 

 

div.sub a { font-size:14px; }

5. subobject Selector
Syntax:

E1 > E2 { sRules } 

Note:
Sub-object selector. Select E2 for all E1 sub-objects.
Example:

Body> P {font-size: 14px ;}

/* The font size of all P objects as sub-objects of the body is 14px */

 

Div ul> li p {font-size: 14px ;}

6. ID Selector
Syntax:

#ID { sRules }

Note:
Id selector. Take the ID of the object as the unique identifier in the document directory tree (DOM) as the selector.
Example:

#note { font-size:14px; width:120px;} 

7. class selector
Syntax:

E.className { sRules } 

Note:
Class selector. You can use this selector in HTML. The effect is equivalent to E [class ~ = Classname]. See attribute selectors ).
In ie5 +, you can specify more than one value for the class attribute (feature) of the object (classname) by specifying the class name of a group of style sheets separated by spaces. For example, <Div class = "class1 class2">.
Example:

Div. Note {font-size: 14px ;}

/* The font size of all Div objects whose class property values are equal to (including) "NOTE" is 14px */

 

. Dream {font-size: 14px ;}

/* The font size of all objects whose class property values are equal to (including) "NOTE" is 14px */

8. Select character groups
Syntax:

E1 , E2 , E3 { sRules } 

Note:
Character group. Apply the same definition to multiple delimiters. You can use commas to separate the delimiters and group them.
Example:

.td1,div a,body { font-size:14px; }

td,div,a { font-size:14px; }

9. Selection of pseudo classes and pseudo objects

Syntax:

E : Pseudo-Classes { sRules } 

E : Pseudo-Elements { sRules }

Note:
Pseudo class and pseudo object selector.
Pseudo-class selector. See pseudo-classes (pseudo-classes) [: Link: hover: active: visited: focus: first-child: First: Left: Right: Lang].
Pseudo object selector. See pseudo object (pseudo-elements) [: First-letter: first-line: Before: After].
Example:

div:first-letter { font-size:14px; } 

a.fly :hover { font-size:14px; color:red; }

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.