View Single Post
Old 02-16-2013, 05:24 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,399
Thanks: 18
Thanked 352 Times in 351 Posts
sunfighter is on a distinguished road
I have a feeling this is not what you want:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
#container{
	height: 150px;
	width: 980px;
	background-color: #171717;
}
.sq{
	height: 50px;
	width: 100px;
	background-color: #385;
	float:left;
	margin: 50px 113px;
}
</style>
</head>

<body>
<div id="container">
	<div class="sq"></div>
	<div class="sq"></div>
	<div class="sq"></div>
</div>
</body>
</html>
You left out some important thing about the three divs inside the mother div. So I made the height, width, and background color.

How to equally space them. Used the parent height and width.
Height 150 - 50 = 100. Divide that by two and it becomes the top and bottom margin.

Width 980 /3 = 326.6 The width space needed by one smaller div. Then 326.6 - 100 = 226.6. And divide that by 2 = 113.3 the left and right margins.
sunfighter is offline   Reply With Quote