--- comments: true date: 2014-03-26 18:04:31 layout: post slug: naming-ui-components-in-oocss title: Naming UI components in OOCSS categories: - Web Development tag: meta: "A way of giving complex, OOCSS-built components more meaningful names" --- One of the biggest—if not most common—complaints about OOCSS is its use of ‘insemantic classes’. Unfortunately, the idea that classes are semantic (in the HTML sense of the term) is something of a fallacy; classes aren’t understood by machines, they’re simply read and/or matched—machines cannot glean any meaning from something whose content is entirely subjective. If you are still on the fence about semantic classes, I would recommend reading [Nicolas Gallagher](https://twitter.com/necolas)’s _excellent_ article, [About HTML semantics and front-end architecture](http://nicolasgallagher.com/about-html-semantics-front-end-architecture/). In it, he discusses what we mean when we talk about semantics, and how HTML semantics differs from developer semantics. The short version is that we should write classes that are useful for developers; classes that are highly reusable, that don’t couple themselves to specific types of content, and classes that describe the _styling’s_ function rather than the _content’s_ function. Traditionally we would refer to these as insemantic classes, but Nicolas does a great job of debunking that. Having a solid grasp of (and, ideally, being in agreement with) his article will really make this one make more sense. **tl;dr** Keep using agnostic, abstract, OOCSS classes in your markup, but add any desired meaning to your HTML via a `data-ui-component` attribute, e.g.: `