Skip to content

Instantly share code, notes, and snippets.

@SaraSoueidan
Created June 8, 2013 02:35
Show Gist options
  • Save SaraSoueidan/5733732 to your computer and use it in GitHub Desktop.
Save SaraSoueidan/5733732 to your computer and use it in GitHub Desktop.
DOM Query (select all elements in a list under a condition)
/*select all elements in a given list on elements as soon or as long as this lists contains
at least a certain number of elements*/
/*useful when we need to start changing styles of elements when they start getting crowded
after a certain number*/
/*for more explanation: http://vimeo.com/31719130 (lea verou's talk)*/
/*Supported in all major moder browsers, and IE >= 9 */
#palette > li:first-child:nth-last-child(n+3) span, /*like media query for the dom, now it checks if
it has at leat 3 elements, and selects the span, in other words, select the span in all
the elements of the list as soon as this list's items exceed 3*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment