The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › Do any of you create classes with one (or two) attributes?
Is this an efficient practice?
.floatLeft {float: left;} .floatRight {float: right;} .noListStyle {list-style-type: none;} .center {margin: 0 auto;} .clear {clear: both;} .blue {color: blue;}
I’ve seen some css that does this, but how far do you go?
I usually have a float left, float right, and clear.
But having something like "blue", no.
I generally don’t like applying multiple classes to an element. If I can avoid it, I will.
Going extreme with it is what is becoming known as object oriented CSS.
It’s contrary to how I was learned up with CSS, but I’m actually building a site right now where this approach is very useful.