Recently, I stumbled upon the :active
element in CSS. To learn more about it, I visited the Mozilla documentation page dedicated to the :active
element.
https://developer.mozilla.org/en-US/docs/Web/CSS/:active
One of the examples they provide is as follows:
form :active {
color: red;
}
form button {
background: white;
}
<form>
<label for="my-button">My button: </label>
<button id="my-button" type="button">Try Clicking Me or My Label!</button>
</form>
I'm curious about why the :active
element applies to all form elements when a space is used between form
and :active
, like in form :active
. How exactly does CSS apply this concept?