This site is designed for accessibility. Content is obtainable and functional to any browser or Internet device. This site's full visual experience is available in a graphical browser that supports web standards. Please consider upgrading your web browser.

The Universal Selector

This selector is like a wild card. It acts like a type element, except it matches any and every element it can. Therefore,

* {color: red;}

would turn every element in the entire document red.

The Universal Selector can be used as part of other selector types. For example:

div * li {font-weight: bold;}

would boldface any li element that is at least a grandchild of a div element.

You could color every element with a class attribute by writing:

*[class] {color: green;}

Match any element that immediately follows an h1 with

h1 + p {…}

Legacy note:

*.class {…}

is equivalent to

.class {…}

(ditto for IDs)