Skip to content Skip to sidebar Skip to footer

How To Center 3 Divs In The Middle Of The Page

Hi I want to center 3 divs to the middle of the page, I have each of them floating left so that they are side by side however I want these to be central to the page. I have them i

Solution 1:

Change the .topWrapper div to have a text-align:center rule, then remove the float:left from those three divs (.left, .center, and .right) and replace them with display:inline-block.

jsFiddle example

.topWrapper {
    width:100%;
    text-align:center;
}
.left {
    width:200px;
    height:200px;
    background-color:red;
    display:inline-block;
    margin-right:20px;
}
.center {
    width:200px;
    height:200px;
    display:inline-block;
    background-color:blue;
    margin-right:20px;
}
.right {
    width:200px;
    height:200px;
    background-color:black;
    display:inline-block;
    margin-right:20px;
}

Post a Comment for "How To Center 3 Divs In The Middle Of The Page"