There are several ways to achieve this, one option is using the display:inline
method:
div.Box {
width: 20%;
height: 250px;
background: red;
display: inline-block;
}
#Container {
text-align: center;
}
JSFiddle (using percent
width)
JSFiddle (using px
width)
div.Box {
width: 200px;
height: 250px;
background: red;
display: inline-block;
}
Another approach is to set float: left;
for div.Box and then specify a fixed width
for the parent element with margin: auto
to center it.
JSFiddle
div.Box {
width: 200px;
height: 250px;
background: red;
float: left;
margin: 0 5px 0 5px;
}
If you want to make it responsive, you can use media
queries for different screen resolutions.