Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML How to Make a Website CSS: Cascading Style Sheets Center the Wrapper

Vladimir Kozak
Vladimir Kozak
6,314 Points

Wrapper id not working?

I have attempted to use a wrapper id to center the surrounded elements but whenever I open up the webpage everything is still aligned on the left hand side. Apparently the div tag is not showing up in this pasting of my code. Imagine it being right before header and after the closing footer tag, and encapsulating all that code.

ideally i need more information than this since your not stating what method your using, so im just going to show you the way i do it.

In your CSS write this

/* This represents the wrapper */
.wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
}

/* This represents multiple DIRECT children of the wrapper */
.wrapper-item {
    width: 10em;
    height: 10em;
    text-align: center;
    background: lightgrey;
}

Valdimir Kozak:

Show your code following the instructions for Markdown Cheatsheet.