Both display:none
and visibility:hidden
are widely supported by CSS-enabled browsers, so only the typical CSS caveats should be considered. They have distinct effects: display:none
removes the element from rendering altogether, while visibility:hidden
retains the element in the document flow but renders it transparent.
The choice between the two methods depends on the specific goal of hiding the element. For instance, if you need to dynamically toggle content using client-side scripting, visibility:hidden
may be preferable as it avoids re-rendering adjacent elements.
Generally, applying both is redundant since display:none
supersedes visibility:hidden
(though conflicting styles in other style sheets might override these properties, causing display:none
to become ineffective).