CSS reset
avoiding browser defaults with the * (global) selector
// updated 2025-05-01 09:11
CSS reset refers to setting as many values of the CSS box model to 0
, in case a "stray" browser decides to add default values that differ from the other more conventional browsers.
The global selector
We use the CSS global selector, *
, to apply a property-value pair to all selectors:
* {
border: 0;
margin: 0;
padding: 0;
}
Such ensures that we have no borders, margins, or paddings, for any elements, until we further specify them in our CSS!
(We could add almost any property-value pair to this asterisk selector, so that we can have more certainty of each property's values.)