:defaultcss selector, what HTML elements come to mind?
<input type='radio">, and
<option> are the first ones that I think of. But did you know that elements inside a form have defaults as well?
With radio and checkbox inputs, any element that has the
checked attribute on page load will have the
input:default styling applied to them.
In the example below, the choices "Blue" and "Morning" are the default values. The default styling on these elements persists throughout interactions with the inputs.
Default form buttons are new to me and they are one of those "oh that's neat" features.
The first button element within a
<form> tag will be the default and styling from
button:default will apply to it.
When I was learning about the
:default pseudo class, I found the selector to be intriguing. Unfortunately, I haven't been able to find a use for it.
This content was originally published by the author at https://codylewis.net/posts/2019/03/the-default-pseudo-class/