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!

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 Responsive Web Design and Testing Refactor the Layout

In detail, why did we set the width to 28.3333% -- I understand the use of percentage but not the numerical value

I understand the use of percentages for fluid but not the numerical value of 28.3333%

2 Answers

Hi Evan,

If you're going to have 3 columns then you first need to figure out how much the margins are taking up for 3 list items.

Each li has 2.5% all around. This means 2.5% on the left and on the right for a total of 5%. So each list item has 5% margin in the horizontal direction. If you're going to have 3 list items then the total margin is 3 * 5% or 15%

If the margins are taking up 15% then you have 85% left over for the widths of the list items.

85% / 3 is 28.3333% This means each list item should be 28.3333% so that it all adds up to 100%

Here's all the math written out in case it helps you understand it better.

(2.5% + 28.3333% + 2.5%) + (2.5% + 28.3333% + 2.5%) + (2.5% + 28.3333% + 2.5%) = 100%

Each set of parentheses represents one list item.

Jason, thank you! That made things clear.