CSS best practices are killing us
CSS ninja Nicole Sullivan argues common CSS practices have outlived their usefulness
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.
For more of Sullivan’s thoughts, check out the notes taken by "digital product design and strategy guy" Luke Wroblewski.
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.
Get the Creative Bloq Newsletter
Daily design news, reviews, how-tos and more, as picked by the editors.
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1
The Creative Bloq team is made up of a group of design fans, and has changed and evolved since Creative Bloq began back in 2012. The current website team consists of eight full-time members of staff: Editor Georgia Coggan, Deputy Editor Rosie Hilder, Ecommerce Editor Beren Neale, Senior News Editor Daniel Piper, Editor, Digital Art and 3D Ian Dean, Tech Reviews Editor Erlingur Einarsson and Ecommerce Writer Beth Nicholls and Staff Writer Natalie Fear, as well as a roster of freelancers from around the world. The 3D World and ImagineFX magazine teams also pitch in, ensuring that content from 3D World and ImagineFX is represented on Creative Bloq.