I understand that we already have a CSS value called unset
where we can revert back to a user-agent default style.
Specifications state:
This keyword effectively erases all declared values occurring earlier in the cascade
However, what if we wanted only a partial erasure of these styles? i.e. an author-controlled default style that unset
could return?
I would propose that there should be a keyword set inline with the CSS property, similar to !important
a {
text-decoration: dotted underline !default;
}
nav a{
text-decoration: none;
}
nav a:hover {
text-decoration: unset; // renders "dotted underline" without having to repeat the style
}
This is especially useful in cases like display
where there is no good “opposite” of none
:
.someModal {
display: flex !default;
}
.someModal.ui-collapsed {
display: none;
}
.someModal.ui-collapsed.ui-peak {
display: unset; // reverted to flex
}
alternatively, if the behavior of unset
can’t be changed, then I would suggest that this be a complement to revert so that revert knows exactly which property to choose from the cascade.