Attribute selector, jquery attribute Selector
The attribute selector can select an element based on its attributes and attribute values.
In CSS3, three attribute selectors are added to enable the attribute selector to have the concept of wildcards.
- [Attr * = val] attribute Selector
If an element uses attr to represent an attribute and its attribute value contains the character specified by val, the element uses this style.
[Id * = "sh"] {font-family: "MS Serif", "New York", serif; color: #76ee00 ;...}
The above code snippet indicates that the HTML5 element id attribute contains the "sh" character. This style can be used.
The attribute selector is also called a restriction selector. It defines the element style based on the specified attribute as a restriction. In addition to the three types mentioned above, there are also four types of selectors: attribute matching, exact attribute matching, blank allocation matching, and character-to-character matching.