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 trialLana Toogood
10,158 PointsHow to center an image in a div?
Hi everyone, I'm trying to build a small flowchart on a webpage with HTML & CSS. It's basically 3 divs (with an image and some text) stacked on top of each other inside another div, and I'm trying to center each image inside the 3 divs horizonally. I have tried applying margin: 0 auto to the images, but they are still sticking to the top left corner of each div. Can someone explain why this is happening and how to center the images? Thanks so much! :)
1 Answer
Jamie Reardon
Treehouse Project ReviewerImages are displayed inline-block, set the display to block and try again.
Lana Toogood
10,158 PointsLana Toogood
10,158 PointsPerfect, that fixed it thank you so much!
Jamie Reardon
Treehouse Project ReviewerJamie Reardon
Treehouse Project ReviewerYou are welcome good luck!