How to make a div with no content have a width with HTML?

Spread the love

Sometimes, we want to make a div with no content have a width with HTML.

In this article, we’ll look at how to make a div with no content have a width with HTML.

How to make a div with no content have a width with HTML?

To make a div with no content have a width with HTML, we add a non-breaking space in the div.

For instance, we write

<div>&nbsp;</div>

to add a div with the &nbsp; non-breaking space to make the div have a width.

Conclusion

To make a div with no content have a width with HTML, we add a non-breaking space in the div.

Leave a Reply

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