-
If you want the element is not visible, does not occupy space, resource loads, DOM can be accessed:
display: none
; -
If you want the element is not visible, you can not click, but take up space, resources are loaded, you can use:
visibility: hidden
; -
If you want the element is not visible, do not take up space, which was hidden when they can
transition
fade effect:
div{ position: absolute; visibility: hidden; opacity: 0; transition: opacity .5s linear; background: cyan; } div.active{ visibility: visible; opacity: 1; }
Used here visibility: hidden
instead display: none
, because the display: none
influence of css3 transition
transition effects.
But display: none
it does not affect the css animation
animation effects.
-
If you want the element is not visible, you can click, take up space, you can use:
opacity: 0
; -
If you want the element is not visible, you can click, does not occupy space, you can use:
opacity: 0; position: abolute;
; -
If you want the element is not visible and can not be clicked, take up space, you can use:
position: relative; z-index: -1;
; -
If you want the element is not visible, can not click, do not take up space, you can use:
position: absolute ; z-index: -1;
;