Home  >  Article  >  Web Front-end  >  How to use css visibility attribute

How to use css visibility attribute

silencement
silencementOriginal
2019-05-26 14:54:155093browse

How to use css visibility attribute

Visibility attribute definition and usage

In CSS, the visibility attribute is used to define whether an element is visible. This attribute defines Invisible elements also take up space on the page. If you want to define an invisible element that does not occupy page space, you can use the display attribute (the difference between the two attributes: the usage of the display and visibility attributes).

visibility attribute value

visible: element is visible (default value)

hidden: element is invisible, hidden

collapse : When used on table elements, a row or column will be deleted without affecting the layout of the table; when used on other elements, it is the same as hidden.

inherit: Inherit the value of the visibility attribute from the parent element.

Grammar format:

visibility:visible / hidden / collapse / inherit

1. visibility:visible; details

visible : The element defined by the visible attribute value is visible and is the default attribute value.

2: visibility:hidden;Details

hidden: The element defined by the hidden attribute value is invisible and will not be displayed, but the element will still occupy the original space.

3. Visibility:collapse;Details

collapse: The collapse attribute value defines that different elements have different effects.

When used on table elements: a row or column will be deleted without affecting the layout of the table;

When used on non-table elements: the effect is the same as the hidden attribute value;

Four: visibility:inherit;Details

inherit: The element defined by the inherit attribute value will inherit the visibility attribute value of the parent element, that is, what is the visibility attribute value of the parent element, and the visibility attribute value of the element is What.

The above is the detailed content of How to use css visibility attribute. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn