HTML and CSS Reference
In-Depth Information
The simplest attribute selector is called
the existence selector :
[itemscope] {
outline: 4px dashed black;
}
When you put the attribute name inside
square brackets, the selector will match
any element that has the attribute.
Attribute selectors can be appended to
other simple selectors. To select only
paragraphs that have an itemscope
attribute, use this selector:
p[itemscope] {
outline: 4px dashed black;
}
Although attribute existence can be
useful occasionally, it's more likely you'll
be interested in selecting between
attributes with values. The syntax for
this is intuitive:
[itemprop="org"] {
outline: 4px dashed black;
}
Note that three elements have an
itemprop attribute that begins with the
letters org , but only the one that exactly
matches has been selected. It's possible
to select the elements whose attribute
begins with org :
[itemprop^="org"] {
outline: 4px dashed black;
display: block;
}
Search WWH ::




Custom Search