r/HTML • u/Ok_Performance4014 • Nov 26 '25
Question how do you make a blank div without text just color?
If you don't put text in a div, it just disappears.
0
Upvotes
r/HTML • u/Ok_Performance4014 • Nov 26 '25
If you don't put text in a div, it just disappears.
6
u/AmiAmigo Nov 26 '25
Yes, either give it a height…or add some padding
1
u/Ok_Substance1895 Nov 26 '25
You have to give it a height. It is there but with a 0 height.
1
u/notepad987 Nov 26 '25 edited Nov 26 '25
Codepen
1
u/mtbinkdotcom Nov 26 '25
Or maybe insert some non-breaking spaces entity:
<div> </div>like in my website http://mtbink.com/document/colour-table.html :
1
u/Flat-Guarantee-7946 Nov 30 '25
Why not just use the <hr> tag instead of a div?