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 trialSheryl Darroch
Treehouse Project ReviewerWhat am I missing in this @for and percentage challenge?
@for $i from 1 through $cols {
.grid__col--#{$i} {
$target : ($width * $i) + ($gutter * ($i -1));
width : percentage($target / $context);
}
}
It keeps giving me an error: invalid CSS after "width . . . .
I defined $target just like they said to, and calculate the width with the percentage. What am I missing?
Thanks!
div {
background-color: green;
}
$cols : 10;
$width : 50px;
$gutter : 15px;
$context : ($width * $cols) + ($gutter * ($cols - 1));
@for $i from 1 through $cols {
$target : ($width * $i) + ($gutter * ($i -1));
.grid__col--#{$i} {
width : percentage($target / $context);
}
}
1 Answer
Sheryl Darroch
Treehouse Project ReviewerI finally figured it out. I was missing a space before the 1.
Andrew Hawes
Python Web Development Techdegree Graduate 28,105 PointsI just found this wondering if the challenge was bugged or something. Somehow, I had the exact same problem. I had -1 instead of - 1. Not sure how I missed that or why I did that.
Sheryl Darroch
Treehouse Project ReviewerSheryl Darroch
Treehouse Project ReviewerI finally figured it out. I was missing a space before the one in my $target: equation. That is 30 minutes I will never get back, but I will probably never make that mistake again. :)