How To Vertically Center Unknown Rows Of Content Inside A Fixed Container

One task css doesn’t make easy is centering objects vertically within their containers. Last summer I offered 6 methods for vertical centering to address that difficulty. The methods generally require knowing in advance the heights of the parent and child elements. What do you do when the child element’s height isn’t known?
Continue reading

BEM: The Block, Element, Modifier Approach To Decoupling HTML And CSS

For the last couple of months I’ve been talking a lot about giving our css best practices a refresh and along the way have looked at approaches such as OOCSS, SMACSS, and DRY CSS. They all have some common underlying principles, one of which is the separation of structure and presentation.
Continue reading

Some Practical Guidelines For Writing CSS

Do you follow a consistent set of practices when writing your css or do you write a few lines of css that work before move on to the next line? Did your best practices grow organically or did you follow a set of guidelines for writing your code?
Continue reading

DRY CSS: Don’t Repeat Your CSS

A few weeks ago in the comments on my post about css formatting, Brett and David pointed me to a couple of articles and a presentation I hadn’t yet seen. All had interesting ideas about css practices and I thought I would offer some of my thoughts on them.
Continue reading

Sass And LESS: An Introduction To CSS Preprocessors

In recent weeks I’ve been looking a lot at css. I’ve looked at abstracting css, changing best practices and how to make our css more modular and scalable. In many of these posts I’ve alluded to css preprocessors and it’s time we start talking about them.
Continue reading