How to hide elements without having them take space on the page with CSS?

Spread the love

Sometimes, we want to hide elements without having them take space on the page with CSS.

In this article, we’ll look at how to hide elements without having them take space on the page with CSS.

How to hide elements without having them take space on the page with CSS?

To hide elements without having them take space on the page with CSS, we set the display property.

For instance, we write

<div style="display: none"></div>

to use display: none to hide the div without it taking up space.

Conclusion

To hide elements without having them take space on the page with CSS, we set the display property.

Leave a Reply

Your email address will not be published.