Skip to content

Instantly share code, notes, and snippets.

@chrisboakes chrisboakes/
Last active May 14, 2019

What would you like to do?
A new approach to our CSS

Atomic CSS

There are many different variations to 'Atomic' CSS. While we could consider the programmatic approach, it's not good for readablity (e.g. Pos(a) Bgc(brandColor) W(columnWidth) H(90px)).

I suggest the following approach because of its readability and scalablity:

  1. Atoms
  2. Molecules
  3. Organisms
  4. Templates
  5. Pages

And Utilities.

Each of these can easily be summarised by the following diagram:

Atomic Design


A single item:


.a-search-label {
	font-size: 12px;


.a-search-input {
	padding: 10px;


.a-search-button {
	text-decoration: none;


A group of atoms bound together:


.m-search-box {
	display: flex;


A group of molecules combined together to form a distinct section of an interface:


.o-site-header {
	display: grid;
	/* Could contain molecules such as .site-logo .navigation and .search-box */


Templates are groups of organisms stitched together:


.t-index {
	/* Could contain organisms such as .site-header .page-content and .site-footer */


Specific variations of template:


.p-gaming {
	/* Variations of the .t-index */


Utilities should be:

  • Easy to understand
  • Execute a single function (e.g. .u-order-first)
  • They should be immutable

Utilities can often be misused to serve more complicated purposes. (e.g. while an accordion may serve a single function it is both configurable and could be implemented differently depending on the use-case, therefore it should be a organism built of molecules which can be modified by a template.


JavaScript logic should never be assigned to any of the classes associated with styling. In most cases logic should be associated with data attributes, however in some scenarios a js- prefix can be applied to the class name.

Immutable CSS

Classes should never be modified, making them more dependable. This is essential to 'proper' atomic architecture. Without it you run the risk of something like:

.my-page--red-theme {
	.black {
		color: red;


Atomic Web Design by Brad Frost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.