Not receiving emails [phpmailer]

I don’t know exactly what you’re asking for, but I assume you want to center a div inside of its parent container. To do that, the div must have a width smaller than the width of the parent container (of course), it must be display: block, and have margin: 0 auto.

You can also center an element with display: inline-block or display: inline by using text-align: center on the parent element. This will center the text inside as well. I think this may be what you want, since you said you wanted to align everything to the center. Just put it all into the div.

For example:

<div class="container">
    <div class="centerthis">
        Lorem ipsum dolor sit amet...
    </div>
</div>

CSS:

.container {
}

.centerthis {
    width: 50%;
    margin: 0 auto;
}

OR:

.container {
    text-align: center;
}

.centerthis {
    display: inline-block; /*or inline*/
    width: 50%;
}

Check out this demo to see it in action.

Leave a Comment