CSS nth-child formula for selecting every 7th element and 5th element

So, I am creating a hexagon with CSS3, and I would like it to look like this:

http://www.upperfirst.com

I have my hexagons floating: left in a body of a certain width. I can efficiently execute the results in the link above if I can select the first item on every other line. What will be the nth-child formula for this?

This will be the 5th element, then every 7th element after that?

+3
source share
1 answer

Formula :nth-child(7n+5). 7nrepresents "every 7th element", and +5represents "starting from the 5th element."

Read more about :nth-child()the Selectors specification .

+19

All Articles