With respect to CSS, we are starting to see a separation of code where the content styles are being split from the look-and-feel styles, and possibly constituting a shift in the way we plan our development for front-end web design. The base architecture is taking on a new character in which CSS style properties are not repeated throughout the stylesheet, but coded once and done. Buzz words and phrases include HTML Semantics, class naming patterns, Object Oriented CSS (OOCSS), BEM system approach, CSS Lint, Scalable and Modular Architecture for CSS, and more.
This post will attempt to highlight several emerging concepts from the recent movement to front-end web design architecture from some of the people who are working on them.
HTML5 Boilerplate, Pure CSS, and HTML Semantics
His more recent and thought provoking post titled, "About HTML semantics and front-end architecture," raises the topic of not only HTML semantics, but components of HTML and CSS, approaches to class naming patterns, and HTTP compression. He also delves into the realm of content-independent class names, reusable and combinable components, which are scalable for both HTML and CSS, and structured class names and naming patterns. He provides examples to illustrate his ideas.
Web developer Jonathan Snook, has written a book about a design process he calls SMACCS, which is pronounced "smacks", and better known as Scalable and Modular Architecture for CSS: A flexible guide to developing sites small and large. The book is available online and in several eBook formats for purchase; the CAD eBook is available for $15 as of this printing.
SMACCS is more of a guideline than an actual framework -- it has no library of code to download or install; rather, it is a design process, allowing you to fit a more flexible development into your existing websites.
The SMACCS process is organized such that you can pick and choose which parts you want to implement. Sections include the core concepts of categorizing CSS rules, base rules, layout rules, module rules, state rules, theme rules, and change state.
SMACSS also addresses topics such as depth of applicability, selector performance, HTML5 and SMACSS, and prototyping. These and many more topics are covered in the boo, which includes an appendix of formatting code and additional resources.
Nicole Sullivan, a web developer and performance engineer at Yahoo has created Object-Oriented CSS (OOCSS), which she defines as "a way of writing scalable, sane, maintainable CSS," not a framework, so much as a "new language." According to the FAQ from the OOCSS wiki, CSS objects consist of four things:
- HTML, which consists of one or more nodes of the DOM,
- CSS declarations about the styles for the nodes which start with a class name for the wrapper node,
- Components such as background images and sprites for display, and
If you are confused now, don't worry; as stated in the FAQ each CSS class is not necessarily considered an object in its own right, but can become a property of a wrapper class. The exercises provided at oocss.org include:
- Starting Template
- Exercise 1: Template
- Exercise 2: Grids
- Exercise 3: Module Manipulation
- Exercise 4: Module Creation.
Start with the first two exercises, which can be completed in Firebug, and then you can download the finished file at the beginning of exercise three.
Nicole also gave a presentation titled, "Our Best Practices Are Killing Us", which is available for viewing on Slideshare. She focuses on making a better way to write CSS, and explains how messy CSS can be a direct result of our worst best-practices. She also points out the need to reexamine the assumptions about best practices and keep our eye on the practicality, scalability, accessibility, standards, and design. The presentation points out examples of CSS duplication across many popular sites such as Facebook, Salesforce, w3c, and the Alexa Top 1000 sites, for example.
The time to act is now, for any website to grow and evolve efficiently many of the tried and true assumptions and base architecture need to take into account future proofing strategies that will ensure a scalable, standard, accessible, practical, and sensible approach to web design.
Ryan has performed in a broad range of technology support roles for electric-generation utilities, including nuclear power plants, and for the telecommunications industry. He has worked in web development for the restaurant industry and the Federal government.