Interactive online courses HTML Academy
2026-03-09 10:59 Diff

Now let’s animate the radio buttons.

First, let’s reduce the closing pseudo-element label::after or “closer” to a size of zero using the scale transform.

When it is activated, we will increase the size of the “closer” to the desired dimensions. In order to control the active state of the “closer, ” we will use a CSS rule with this selector:

input[type="radio"]:checked ~ label::after { ... }

The smooth transition properties, just like in the previous examples, will be added to the CSS rule for the initial state:

label::after { ... }