Visit homepage

CSS unset

  • Planted:

To reset a CSS property to its default value, you can use the unset value:

styles.css

button {
all: unset;
}

That saves a couple lines from the alternative:

styles.css

button {
padding: 0;
border: none;
background-color: transparent;
}

I find myself doing the latter pretty often, so this should save a couple lines many times over.

Credit Radix UI docs for the find. unset is widely supported by modern browsers: caniuse.com/?search=unset