LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

What does the universal selector (*) do in CSS?

The universal selector * matches every element in the document, so a rule written with it applies to absolutely everything.

It is most often used to wipe out the browser's default spacing before you build your own, or to set one property globally:

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

Common uses:

  • CSS resets — flattening inconsistent default margins/padding across browsers.
  • Setting box-sizing site-wide so width maths behaves predictably (see the box-sizing card).
  • Debugging* { border: 1px solid red; } outlines every box so you can see the layout.

Two things worth remembering. First, * has effectively zero specificity, so any more targeted rule (an element, class or id selector) will override it — handy, because you can lay down a baseline and then refine. Second, it is fine on its own in modern browsers, but piling it into deep descendant chains like * * * makes the browser test far more elements than necessary, so avoid that.

From Quiz: WEBT / CSS Basics | Updated: Jun 20, 2026