Visibility
Anonymous contributor
Anonymous contributor1 total contribution
Anonymous contributor
Published Jul 13, 2021Updated Feb 5, 2024
Contribute to Docs
The visibility property shows or hides an element. If the element is hidden, it will still take up space within the page.
Syntax
visibility: <value>;
The visibility property has three values.
visible
: Shows the element.hidden
: Hides the element.collapse
: Hides both the element and the space it would have occupied.
Note: collapse
should only be used with <table>
rows, row groups, columns, and column groups. If collapse
is used on other elements, it will be treated the same as hidden
. Implementing collapse within a <table>
can be especially useful because it allows for hiding rows or columns without affecting the table layout.
Example 1
Hiding an element with a class
of hide
.
.hide {visibility: hidden;}
Example 2
Hiding a <tr>
element within a table.
tr {visibility: collapse;}
All contributors
- Anonymous contributorAnonymous contributor1 total contribution
- christian.dinh2476 total contributions
- Anonymous contributorAnonymous contributor3071 total contributions
- asiqurr43 total contributions
- Anonymous contributor
- christian.dinh
- Anonymous contributor
- asiqurr
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.