Heydon Pickering: Solving problems with selectors
Heydon Pickering was talking about using CSS at Responsive Conf, these are my notes from his talk.
CSS selectors are like regexs for markup.
Dynamic content needs dynamic layout. Most grid systems are grid prescriptions - they don't work with arbitary content. We should be able to feed in content and the CSS with sort out the layout.
Prime numbers create problems for divisibility. Flexbox solves some of these problems with dynamic content - it has algorithms built into it. Flexbox is good at getting rid of orphans. Because it won't break you can build on it as a baseline.
:nth-last-child(n+8) Helps us adapt to the quantity of content. Allows us to change the layout based on the quantity contained within it.
Write comments - your code isn't as self documenting as you think it is. Use mixins to abstract away the complex syntax.
These selectors don't have performance problems except in edge cases.