Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS How to Make a Website CSS: Cascading Style Sheets Style the Basic Elements

center it on the page using the margin property.

Help me with this please..

If it is an image use:

img {
display: block;
margin: 0 auto;
}

If it is, for example, a paragraph, only use margin:

p {
margin: 0 auto;
}
Andrew McCormick
Andrew McCormick
17,730 Points

@martinfrank I noticed that you asked two questions in a row that corresponded to the first two questions in the code challenge and were answered by watching the videos leading up to the challenge. Please don't waste an opportunity to learn here at Treehouse by just trying to answer the challenges. Make sure to watch the videos that lead up the questions.

If you are watching the videos, then when you come to ask a question on the forum please post the code that you're already tired so that we can see you are making a valiant attempt. thanks.

2 Answers

Andrew McCormick
Andrew McCormick
17,730 Points

check out a couple videos back, right at the 20sec mark. link to video: center the wrapper

@andrew McCormik I know. I watched the video but i really couldn't type the code right. The first question was obvious but the second one was really hard for me :-). Did something wrong.