HTML and CSS Reference
In-Depth Information
Similarly, you can select all the elements
whose
itemprop
attribute ends with a
particular value:
[itemprop$="name"] {
outline: 4px dashed black;
display: block;
}
In the examples so far, the attribute
value you're trying to match is a
simple string, so quotes are optional.
You could also write this selector as
[itemprop$=name]
. If the value you're
matching contains characters other
than letters and numbers, then the
quotes are required.
If the significant part of the attribute
value is in the middle rather than at the
start or the end, there's also an attribute
selector for that:
[itemprop*="tion"] {
outline: 4px dashed black;
display: block;
}
This rule matches any element which
has an
itemprop
property with a value
which contains
tion
somewhere
within it.
You can now write selectors that match all three
examples you saw at the start of this section:
External links:
a[href^="http://"]
Specific URLs:
a[href="/home"]
File downloads:
a[href$=".pdf"]