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 trialMax Reinsch
5,740 PointsWidth percentages
Why are the width percentages what they are? They're very precise but I don't know exactly why.
@media screen and (min-width: 481px) {
.col {
float:left;
}
.main {
width:65.957446808511%;
}
.secondary {
width:31.914893617021%;
margin-left:2.127659574468%;
}
}
2 Answers
adam åslund
Courses Plus Student 12,184 PointsHi Max, the reason for being precise is to avoid errors.
If you round up at 2 decimals then the code would look like this.
@media screen and (min-width: 481px) {
.col {
float:left;
}
.main {
width:65.96%;
}
.secondary {
width:31.91%;
margin-left:2.13%;
}
}
There would have been some width added to .main width and .secondary margin-left. This could make it so that the element get pushed down instead of being in 1row.
Max Reinsch
5,740 PointsAh, I just realised it adds up to exactly 100%.
Max Reinsch
5,740 PointsD'oh.