Forums

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?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28579
    z1freeride
    Member

    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?

    #73214
    TheDoc
    Member

    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.

    #73229
    Chris Coyier
    Keymaster

    Going extreme with it is what is becoming known as object oriented CSS.

    Code:

    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.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.