Created
April 9, 2015 15:36
-
-
Save mishelen/6ae10cba8917ce8093e9 to your computer and use it in GitHub Desktop.
Quantity Queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Quantity 6 | |
| li:nth-last-child(6):first-child, | |
| li:nth-last-child(6):first-child ~ li { | |
| /* rules */ | |
| } | |
| // The advantage of :nth-last-of-type(), | |
| // on the other hand, is that you are able | |
| // to target groups of like elements | |
| // where other siblings of different types are present. | |
| // More than or equal to 6 | |
| li:nth-last-child(n+6), | |
| li:nth-last-child(n+6) ~ li { | |
| /* rules */ | |
| } | |
| // apply the described technique across different element type siblings | |
| .container > :nth-last-child(n+3), | |
| .container > :nth-last-child(n+3) ~ * { | |
| /* rules */ | |
| } | |
| // Fewer than or equal to 6 | |
| li:nth-last-child(-n+6):first-child, | |
| li:nth-last-child(-n+6):first-child ~ li { | |
| /* rules */ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment