Use the CSS Visibility Property to Hide and Show Absolutely Positioned Elements

You should use the Cascading Style Sheets (CSS) visibility property to hide and show absolutely positioned elements. There is no need to use the CSS display property in the case of an absolutely positioned element, as display and visibility have exactly the same effect. Both display and visibility make an element disappear. The difference is that when an element is set to display: none, it no longer takes up space in the document flow. An element set to visibility: hidden is invisible, but still takes up space in the document flow. But an element that is absolutely positioned never takes up document flow space. So there is no difference in using display and visibility. Display is the more expensive of the two CSS properties, so if you are making elements appear and disappear often, visibility will be faster.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: