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 Styling Web Pages and Navigation Style the Image Captions

3 column layout

In order to style a 3 column layout, I would need to float and add margin to both the first and second image?

1 Answer

Mark Pryce
Mark Pryce
8,804 Points

Not 100% sure what your asking but to create 3 columns you would need to use some simple maths.

If you add a margin of 2.5% on an image, left and right 2.5 * 2 = 5%

5% margin for each image and you want 3 images so 5% * 3 = 15% of margin for all your in-line images.

This will leave you with 85% left to fill so 85 / 3 = 28.333333.

28.3333333% is the width you want each list item / image to fill the parent element.

I hope that is what your asking. Happy coding.

Thank you.