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 trialManu Santana
8,329 PointsColor Helpers... How can apply the linear-gradient to the rest of li:nth-child with a mixing or similar?
I'd like apply the gradient to the rest of nth-child and I don't know if it's possible.
In this example.
.colors {
li {
background-color: $base;
}
li:nth-child(2) {
background: adjust-lightness($base, 10%);
}
li:nth-child(3) {
background: adjust-saturation($base, 30%);
}
li:nth-child(4) {
@include background ( linear-gradient($base, shade($base, 50%)));
}
li:nth-child(5) {
background: tint($base, 40%);
}
Thank you in advance
1 Answer
Manu Santana
8,329 PointsDear Nick,
Thank for your answer. But I'm referring to create a mixin or similar to write the code the simplest way. Thanks again.
nik
8,925 Pointsnik
8,925 PointsSo heres a couple ways. You can select every other child by specifying odd or even within the perenthesis.
You can also choose every third, sixth or tenth child by using expressions. This one selects every third.
li:nth-child(n3+3) { }
hope this helps.