Share this postCSS isn't magicThe hidden attribute removes the need to define display: noneCopy linkFacebookEmailNotesMoreThe hidden attribute removes the need to define display: noneStas MelnikovJun 11, 2025Share this postCSS isn't magicThe hidden attribute removes the need to define display: noneCopy linkFacebookEmailNotesMoreShareWe don't need to define display: none by hand when creating the elements that can be shown or hidden. Just add the hidden attribute to the element and define all CSS with :not([hidden])!