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

General Discussion

Bootstrap beginner question | center images within columns on mobile

Hello,

The site in question is housed at http://www.samplacedesigns.com/prohardware/

I'm trying to have the images in the following html center once the layout goes to mobile.

<div class="row red-row"> <!-- Row 2 --> <div class="container"><!-- container 2 --> <div class="col-lg-4 col-md-4 col-sm-4"> <img src="http://www.samplacedesigns.com/prohardware/images/home-3column-placeholder.jpg" class="img-responsive" alt="grid magazine covers professional hardware solutions"> </div> <div class="col-lg-4 col-md-4 col-sm-4"> <img src="http://www.samplacedesigns.com/prohardware/images/home-3column-placeholder.jpg" class="img-responsive" alt="grid magazine covers professional hardware solutions"> </div> <div class="col-lg-4 col-md-4 col-sm-4"> <img src="http://www.samplacedesigns.com/prohardware/images/home-3column-placeholder.jpg" class="img-responsive" alt="grid magazine covers professional hardware solutions"> </div> </div><!-- End container 2 -->

Thanks!

1 Answer

Never mind, I tried using center-block before, but I had it in the div column instead of the img tag.

This works <img src="http://www.samplacedesigns.com/prohardware/images/home-3column-placeholder.jpg" class="img-responsive center-block" alt="grid magazine covers professional hardware solutions">