Skip to content Skip to sidebar Skip to footer

Centering Multiline Floated Elements

I've been trying/searching for a while, but I can't make it work.
  • <

Solution 1:

Just set on all your Div instead of Float:left; just put display: inline-block; it will put each element one after the other. Then just set your wrapper to be margin: 0 auto;.

.project-box { 
display: inline-block;
}

.wrapper {
width: 1024px;
height: auto;
margin: 0 auto;
}

Solution 2:

The solution that worked for me:

<style>
    .project-container {
        /* To center the list */
        text-align: center;
    }

    ul {
        /* To reset 'text-align' to the default */
        text-align: left;

        display: inline;
    }

    li,
    .project-box {
        display: inline-block;
    }
</style>

Post a Comment for "Centering Multiline Floated Elements"