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

My <div id="wrapper"> does not center as displayed in the video

https://teamtreehouse.com/workspaces/28466512#

would a more experienced set of eyes please advise?

1 Answer

Austin Whipple
Austin Whipple
29,725 Points

Mike,

As Kevin mentioned, a functional link to your workspace would be very helpful in helping us determine the issue. Without seeing the code, I recommend checking that your #wrapper div has the appropriate width and margin declarations. Something along the lines of this should do the trick:

#wrapper {

   /* Setting a width prevents the block-level element default of stretching to 100% of the width of its parent element. */
   max-width: 860px;

   /*  The zero here removes any margin above and below the element while auto fills the space to the left and right equally to effectively center the wrapper element. */
   margin: 0 auto;

}