Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

How to add spaces using div in HTML

Writer 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?

1

2 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>&nbsp;&nbsp;&nbsp;

Note that &nbsp; 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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy