Heydon Pickering: Solving problems with selectors

Orde Saunders' avatarPublished: by Orde Saunders

Heydon Pickering was talking about using CSS at Responsive Conf, these are my notes from his talk.

"I don't like CSS, it's badly designed" => "I like JavaScript".  It's fucking pointless to recreate CSS in JavaScript you maniacs.

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.

Quantity queries

: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.


Comments, suggestions, corrections? Contact me via this website