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 trial

CSS

Chase Gonzales
Chase Gonzales
1,920 Points

what exactly does the (4n) stand for?

what exactly does the (4n) stand for?

1 Answer

james south
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

the 4n means every 4th element. the syntax is an + b, where a and b are integers and the first index is 1. some examples from the docs: n is every element, 2n is every other element, the evens, 2n+1 is every other element, but starting at 1, so the odds, 3n+4 is every 3rd element, starting at element 4, so 4, 7, 10 etc. you can also use 0n + b to select a particular element, so 5 would be the fifth element only, 2 would be the second element only, etc.