I have several blue rectangles with known dimensions (180 x 180 px) within a container of unknown size.
<html>
<head>
<style>
@import url('http://getbootstrap.com/dist/css/bootstrap.css');
.content {
border:1px solid black;
background-color: grey;
overflow:hidden;
text-align:center;
}
.block {
width: 180px;
height: 180px;
border: 1px solid black;
background-color:blue;
margin: 0 5px 5px 0;
float:left;
}
</style>
</head>
<body>
<div class="row">
<div class="col-md-6">
<div class="content">
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
</div>
</div>
</div>
</body>
</html>
View the code on my example link.
I am looking for two ways to horizontally center these blue squares.
First method:
Second method: