Should You Use Inline-Blocks As A Substitute For Floats?

When it comes to developing a site layout with css, floats do most of the heavy lifting. We use them for the big blocks like our main content and sidebar and we use them for the smaller blocks inside these big ones. Are floats always the answer?
Continue reading

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

css.php