This sort of thing can be done without CSS, by using a combination of actions, component visibility and data editor logic. See example below:
The example shown in the link above does use some CSS, but that’s only to inset the switch components. The functionality itself doesn’t require any CSS.