Welcome to the Treehouse Community
Looking to learn something new?
Brenda Krafft18,036 Points
Long percentages in adaptive Media Queries
OK, I get that you want to be as detailed as possible with this, but how do you come up with these long percentage values? What's the math behind that?
Jacob Miller12,466 Points
Target ÷ Context = Result. So for example, if you wanted to convert a margin of 21px into a percentage. Lets say the margin is on a div inside the body element which has a max-width of 960px. So the math would be: 21 ÷ 960 = 0.021875. Then you convert that into a percentage by moving the decimal point two places to the right. So your percentage would be 2.1875%. Some combinations of target and context will produce those really long decimals that you see in the code challenge.