Universal selector in CSS
The universal selector * allows
you to select all elements.
Syntax
* {
}
Example
Let's select all the elements and color them red:
* {
color: red;
}
Example
Let's select all the elements inside
the div tag and color them red:
div * {
color: red;
}
Example
Let's select all the elements directly
inside the div tag and color
them red:
div > * {
color: red;
}
Example
Let's select all elements that are inside
the span tag, which in turn is inside
any tag that in turn is inside the div
tag:
div * span {
color: red;
}
See also
-
the
border-widthproperty
that specifies a border width -
the
border-styleproperty
that specifies a border type -
the
borderproperty
that is a shorthand property for a border