Universal Selector (CSS selector)

Browser support (more…)
IE8+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full


* {
declaration block


The universal selector matches any element type. It can be implied (and therefore omitted) if it isn’t the only component of the simple selector. The two selector examples shown here are equivalent:

*.warning {
  ⋮ declarations
.warning {
  ⋮ declarations

It’s important not to confuse the universal selector with a wildcard character—the universal selector doesn’t match “zero or more elements.” Consider the following HTML fragment:

    <h1>The <em>Universal</em> Selector</h1>
    <p>We must <em>emphasize</em> the following:</p>
      <li>It's <em>not</em> a wildcard.</li>
      <li>It matches elements regardless of <em>type</em>.</li>
    This is an <em>immediate</em> child of the division.

The selector div * em will match the following em elements:

  • “Universal” in the h1 element (* matches the <h1>)
  • “emphasize” in the p element (* matches the <p>)
  • “not” in the first li element (* matches the <ul> or the <li>)
  • “type” in the second li element (* matches the <ul> or the <li>)

However, it won’t match the <em>immediate</em> element, since that’s an immediate child of the div element—there’s nothing between <div> and <em> for the * to match.


This rule set will be applied to every element in a document:

* {
  margin: 0;
  padding: 0;


Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Buggy Buggy Buggy Full Full Full Full Full Full Full Full Full Full Full Full Full Full

Internet Explorer versions up to and including 6 exhibit the star HTML selector bug: selectors that should fail, don’t. A descendant selector, such as * html, shouldn’t match any elements, because the html element is the top-most parent element and, as such, it can’t be a descendant of any other element. However, Internet Explorer versions 5.5 and 6 ignore the universal selector at the beginning of this selector.

When the universal selector is immediately adjacent to an element type selector, Internet Explorer versions 6 and 7 will interpret the combination as a descendant selector instead of failing as they should.

In Internet Explorer 6 and 7, this selector will also select some inappropriate SGML elements such as the doctype declaration and comments.

In Opera 9.2, this selector will also match any recognized processing instructions.

User-contributed notes

Related Products