Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Web
Expertise: Intermediate
Jun 24, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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.
Jai Bardhan
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date