In her talk at An Event Apart 2011, Nicole Sullivan, an “evangelist, frontend performance consultant, CSS Ninja, and author”, took to the stage to argue that a number of CSS best practices were now outdated and doing more to hinder than to help those within the industry.
She argued that it’s a myth that pixel-oriented site elements are bad, noting that the anti-pixel movement gained most traction due to Internet Explorer 6 not allowing fonts to be resized when they were defined in pixels; however, all modern browsers now have a full-page zoom. By comparison, ems and percentages when nested are not predictable.
Sullivan also criticised some techniques relating to mark-up, such as the desire to not include any extra mark-up. And yet she stated that if you let any one module do too much, you can end up with problems. An over-reliance on semantics was also touched on, with coupling CSS too tightly to content leading to maintenance and repetition issues. Sullivan said that common elements and presentational aspects of a design should be abstracted out wherever possible, rather than designers heading for more specificity. For much the same reason, Sullivan argued that designers should work more heavily with classes rather than IDs when styling elements, and avoid the descendent selector, !important and inline styles.
For designers increasingly told to minimise code and make CSS more specific to certain elements, such arguments might be counter-intuitive, but Sullivan’s focus on enabling easier maintenance work over tiny leaps in performance will likely hit home with anyone who’s battled a complex existing website’s styles through many hours buried in Firebug.
What are your thoughts on Sullivan’s arguments? Are designers and devs letting historical best practices cloud their judgment when working on sites? In what ways do you ensure your CSS is both efficient and easy for others to use and edit? Let us know in the comments.