I have this code…
<div style=“width:800px; margin:0 auto;”>
<div><label for=“reference number”>Reference Number</label><span style=“display:bloc;margin-left:200px”>1234</span></div>
<div><label for=“NIC number”>Driving License No</label><span style=“display:bloc;margin-left:85px”>89765432</span></div>
</div>
I want to put a space between these two red div in the display.
How to put space between div ?
Kakarot720:
Use the margin property.
I put stye=“margin-top: 50px;” in the second div. It does not impact.
What is the workaround ?
ronpat
August 23, 2013, 2:40am
4
There is no workaround. Where did you put it?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width">
<title>vertical margin</title>
<!--
http://www.sitepoint.com/forums/showthread.php?1165664-How-to-put-space-between-div
Thread: How to put space between div ?
2013.08.22 12:17
windowsxp
-->
</head>
<body>
<div style="width:800px; margin:0 auto;">
<div>
<label for="reference number">Reference Number</label>
<span style="display:inline-block;margin-left:200px">1234</span>
</div>
<div style="margin-top:50px;">
<label for="NIC number">Driving License No</label>
<span style="display:inline-block;margin-left:85px;">89765432</span>
</div>
</div>
</body>
</html>
PaulOB
August 24, 2013, 11:33am
5
Hi,
If you were looking to put some space around both those divs as a whole then add padding to the main wrapper as a margin on the second div will collapse onto the wrapper and move the wrapper not the second div.
<div style="width:800px; margin:0 auto;[B]padding:20px 0;[/B]">
<div><label etc..