written 6.1 years ago by
teamques10
★ 64k
|
•
modified 6.1 years ago
|
1.Type selector
Selects all elements that match the given node name.
- Syntax: eltname
- Example: input will match any <input> element.
2.Class selector
Selects all elements that have the given class attribute.
- Syntax: .classname
- Example: .index will match any element that has a class of "index".
3.ID selector
Selects an element based on the value of its id attribute. There should be only one element with a given ID in a document.
- Syntax: #idname
- Example: #toc will match the element that has the ID "toc".
4.Universal selector
Selects all elements. Optionally, it may be restricted to a specific namespace or to all namespaces.
- Syntax: * ns|* |
- Example: * will match all the elements of the document.
5.Attribute selector
Selects elements based on the value of the given attribute.
- Syntax: [attr] [attr=value] [attr~=value] [attr|=value] [attr^=value] [attr$=value] [attr*=value]
- Example: [autoplay] will match all elements that have the autoplay attribute set (to any value).