Basically I have four divs contained in another div, and I want the four divs to be centered.
I have used float: left on the four divs so that they are horizontally next to each other.
CSS:
<style>
.square
{
float: left;
margin:1pt;
width:72pt;
height:72pt;
}
.container
{
text-align:center;
width:450pt;
height: 80pt;
}
</style>
and HTML:
<div class = "container">
<div class = "square">...</div>
<div class = "square">...</div>
<div class = "square">...</div>
<div class = "square">...</div>
</div>
How can I center the four divs inside the container?
EDIT: The number of div inside the container may not always be 4, it could be 3 or 2 (There is actually some php around that code...).