HTML and CSS Reference
In-Depth Information
The class selector matches elements with the specified class name. For
elements whose
class
attribute contains multiple space-separated
words, the class selector will select an element if
any
of those words
match the specified class name.
.help {} /* matches all elements with a class of help */
img.thumbnail {} /* matches image elements with class of
thumbnail */
In addition to
id
and
class
attributes, any attribute can be used for
selection with via attribute selectors.
[att]
Selects elements with the attribute
att
, regardless of the attribute's
value.
input[required] {} /* matches html5 input elements with the
required attribute */
Selects elements with the attribute
att
with the value equal to
val
.
a[rel=tag] {} /* matches anchors with the rel attribute equal
to tag */