Is it possible within a radio-group to change the style of a radio button that has not been checked after the other button has been checked?
I have 5 radio boxes. I gave a custom style to the checked ones with the :checked pseudo class. But when a control is checked I want the others to be less visible. I used the negation :not(:checked), but in case none of the controls is checked, all of them are less visible. I just want the unchecked controls of a radio-group to be less visible after another control of this group has been checked.
How can I do this with javascript or css?
The OP might make use of the
:focus-withincss pseudo class like demonstrated with the below provided example.The next provided example applies fixes and improvements (e.g. tab navigable, valid markup, no empty / or unnecessary decorating span elements) to the OP's codepen code.