This question is purely hypothetical; I don't intend to use the methods discussed here. The intention is to learn more about CSS selectors.
Consider an HTML page containing a checkbox. If the checkbox is selected, the background of the body element is red. Otherwise it is blue.
Is this possible to achieve using currently usable selectors in CSS?
Here are the constraints:
- No javascript anywhere
- No divs overlaying the entire page. It must be the body element's background property.
- No future CSS selectors like
:has
. Ideally the method should be demonstrable in a Codepen.