Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to cover a web component?

When I try to modify the way a web page is displayed in my browser, to not display certain elements, I added to its style display: hidden, but this CSS statement not only undisplays the elements, but also moves them out of the flow, pushing following elements ahead to take up space the left, which is not what I want exactly.

I want to just cover instead of delete these elements I don’t want to see, to make them displayed the same color as the background, without moving their place.

Which CSS property may help me out here?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

There are two properties you can use instead of display: hidden :

visibility: hidden : It hides the element from view but they will still occupy space on the page

opacity: 0 : It will cover the element with same background as on the page as occupying space.

If you want the elements to be completely invisible but still occupy space, use visibility: hidden If you want the elements to be transparent but still occupy space, use opacity: 0

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading