How to add spaces using div in HTML
Sebastian Wright
I want to add spaces between two widgets. Please tell me an inline div code to add a space of around 300px. I have used this code:
<div></div> but I couldn't see 300px gap between the two widgets.
How to add this much gap between those widgets?
12 Answers
Check this example , if you are keeping the div empty you need to give it a height than only it will occupy the space .
.div1{width:200px;background:#ddd;height:200px;display:inline-block}
.div2{width:200px;background:red;height:200px;display:inline-block}
.gap{width:200px;background:none;height:200px;display:inline-block;}<div class='div1'></div><div class='gap'></div><div class='div2'></div> edit: removed solution that had already been tried but was not yet in the question
Pure HTML:
<div></div>
Note that represents a single space, so keep adding them until you have enough. Note that this is an extremely crude and not-recommended solution. For a pure CSS solution, see the demo.
edit: here is a demo
4