Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS What are the general rules on when to use OOCSS?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #45238
    iamacatperson
    Participant

    I mean what are the general rules on whether to use an object as something that would be reusable (e.g. buttons / tables / media) VS something that would most likely than not be unique (e.g. intro section with a class called “intro”).

    Of course, we might find out that the intro section style might need to be re-used later for some other part but we have already previously named it “intro”, thinking that it’s quite a unique section on its own. To solve it, we can re-name “intro” as a generic “box-1” so whatever the content is, we are able to use it.

    Should we stop naming our classes as **header, footer, main-content** and use **box-1, box-2, box-3**, etc. so we can conveniently re-use them for any other parts without changing the existing class name or repeating the same styles for a different class name?

    I just want to strike a balance between the two.

    #136831

    I just like to make sure my classes are as reusable as possible.

    I might start off with a bunch of semantic class names, only to realize that I’m just making the same declarations over and over again in my CSS. When I notice this happening, I’ll create a more reusable class and use the semantic class names for fine-tuning.

    That said, I don’t think class names should have to be semantic—the semantics of class names doesn’t really affect anybody (since when do screen readers care about class names?).

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.