How to create a hidden div that doesn’t create a line break or horizontal space with HTML and CSS?

Spread the love

Sometimes, we want to create a hidden div that doesn’t create a line break or horizontal space with HTML and CSS.

In this article, we’ll look at how to create a hidden div that doesn’t create a line break or horizontal space with HTML and CSS.

How to create a hidden div that doesn’t create a line break or horizontal space with HTML and CSS?

To create a hidden div that doesn’t create a line break or horizontal space with HTML and CSS, we set the display CSS property to none.

For instance, we write

<div id="divCheckbox" style="display: none">...</div>

to make the div hidden by setting the style attribute to display: none.

Setting the display CSS property to none would make the div not take up any space when it’s hidden.

Conclusion

To create a hidden div that doesn’t create a line break or horizontal space with HTML and CSS, we set the display CSS property to none.

Leave a Reply

Your email address will not be published. Required fields are marked *