jordazzle jordazzle - 7 months ago 47
HTML Question

Horizontally Center two divs within a container div

I found this similar question but could not get it to work.

I have two div containers labelled in my CSS as "box" and I can't get them to be centered within their parent div (labelled as "wrapper" in my CSS)

Here's my code:


.wrapper {
display: inline-block;
margin: 0 auto;

.box {
display: inline-block;
height: 370px;
padding-left: 5px;
padding-right: 5px;
vertical-align: top;

Any help would be greatly appreciated!


You should change some styling for the wrapper and you'll be good:

.wrapper {
    display: block;
    text-align: center;