Account
Categories

CSS Visibility


When you use the visibility property on any HTML element, it helps you make that element either visible or hidden. It has two main values: visible (the element shows up) and hidden (the element becomes invisible). Even if the element becomes hidden, its place on the page stays the same — the space doesn't go away. Syntax: selector { visibility: value; /* visible or hidden */ } Example:

I am visible (default behavior).

I am invisible, but my space is still here.

Output: First line: visible I am visible (default behavior). Second line: hidden List of Parameters parameter discripition Visible – This means the element will be fully shown on the screen. It’s the default value. Hidden – When you use this, the element won’t be visible on the screen, but the space it takes will still be there. Collapse – This is mostly used for table elements. When applied, the row or column gets hidden, and sometimes its space is also removed (depending on the browser). Inherit – This makes the element take the same visibility as its parent element. Initial – This resets the visibility to its default value (which is usually visible). Unset – This works like a mix of inherit and initial.