{"id":14130,"date":"2011-09-06T18:58:52","date_gmt":"2011-09-07T01:58:52","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=14130"},"modified":"2021-02-22T15:27:41","modified_gmt":"2021-02-22T23:27:41","slug":"visibility","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/v\/visibility\/","title":{"rendered":"visibility"},"content":{"rendered":"\n

The visibility<\/code> property in CSS has two different functions. It hides rows and columns of a table, and it also hides an element without changing the layout<\/em>.<\/p>\n\n\n\n

p {\n  visibility: hidden;\n}\ntr {\n  visibility: collapse;\n}<\/code><\/pre>\n\n\n\n

visibility<\/code> has four valid values: visible<\/code>, hidden<\/code>, collapse<\/code>, and inherit<\/code>. We\u2019ll go through each of them to learn more.<\/p>\n\n\n

<\/a>visible<\/h4>\n\n\n

Just like it sounds, visible<\/code> makes things visible. Nothing is hidden by default, so this value does nothing unless you have set hidden<\/code> on this or a parent of this element.<\/p>\n\n\n

<\/a>hidden<\/h4>\n\n\n

The\u00a0hidden<\/code>\u00a0value hides things. This is different than using\u00a0display: none<\/code>, because\u00a0hidden<\/code>\u00a0only\u00a0visually<\/em>\u00a0hides elements. The element is still there, and still takes up space on the page, but you can\u2019t see it anymore (kind of like turning the opacity to 0). Interestingly, this property does not inherit by default. That means that, unlike the\u00a0display<\/code>\u00a0or\u00a0opacity<\/code>\u00a0properties, you can make an element\u00a0hidden<\/code>, and still have one of its children as\u00a0visible<\/code>, like this:<\/p>\n\n\n\n