The tool you could use (because it is probably more suitable to this task) is the flexbox
. Here is the simple code example:
#flexContainer {
display: flex;
flex-wrap: wrap;
}
#flexContainer div {
flex-grow: 1;
flex-basis: 50%;
text-align: center;
box-sizing: border-box;
border: 1px solid white;
background-color: #CCC;
}
<div id="flexContainer">
<div>1</div>
<div>2</div>
<div>3 - center in next row</div>
</div>
I am not sure if this is what you meant though. If you didn't want to make the third div take the full width of the row, it is possible too:
#flexContainer {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
#flexContainer div {
flex-basis: 50%;
text-align: center;
box-sizing: border-box;
border: 1px solid white;
background-color: #CCC;
}
<div id="flexContainer">
<div>1</div>
<div>2</div>
<div>3 - center in next row</div>
</div>