Class Presentation
Eric Meyer’s post Class Presentation has started an interesting discussion on how to keep class names non-presentational.
As an example Eric mentions class names for images, something I took some time to think about while preparing for the recent redesign of this site. I used to have class names like bordered
and padded
, which didn’t feel quite right.
I’m not so sure what I replaced them with is a whole lot better, but at least I started thinking about it. I use flow
for images that are supposed to let text flow around them, and fullwidth
for those images that should not. Since I want only some images to have a decoration (border
and padding
) I use an additional class name, dec
(as in “decorated”), for those images.
Perfect? Probably not. Less presentational than bordered
and padded
? I think so.
- Previous post: CSS tips and tricks, Part 2
- Next post: Usability testing without a budget