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

CSS How to Make a Website Adding Pages to a Website Style New Pages

Scarf Pablo
Scarf Pablo
1,994 Points

my picture wont center. I have all the code right and it is to the left.

I am trying to center the picture. When I had it on display:block; it literally went to the right side of the header, not visible on the page. So I switched it to display:inline-block;. This made it visible, but it is on the left side even when I have the margin on auto. I do not understand where I am in the wrong. Thanks in advance !

Hi, could you paste all your code please.

3 Answers

First, you should wrap it in a div or something else. Then there are two things you can try. First, try applying margin: 0 auto to the container, not the actual image itself. It that doesn't work, apply text-align: center to the container.

Cesar Vanbuskirk
Cesar Vanbuskirk
6,672 Points

Like Ryan said ^ put the image in a div or set the image to display:block, THEN try setting your margin to auto.

I had the same problem using a Firefox browser and I tried this. I wrapped the photo in the about.html in a div named "photo", then coded my css this way:

photo {

display: block;

max-width: 150px;

margin: 0 auto; }

.profile-photo {

border-radius: 100%;

}

(There is a hashtag symbol in front of "photo", sorry.) Hope this helps.