Skip to main content
Classes, ids and styles organization Started by emanuele · · Read 2962 times 0 Members and 1 Guest are viewing this topic. previous topic - next topic

Classes, ids and styles organization

While writing addons, I frequently find myself swear around because the style of a block depends upon an id and so I cannot "borrow" it for my addon and I cannot inherit the style from the "current theme", but I have to write my own set of css in order to let make my piece of html look similar to the one I have just few pixels above.

Practical example: #description_board.
I was trying to add another box that should look like the #description_board one, and I hoped to just attach a class and be happy (actually I imagined it wouldn't be that easy :P). Unfortunately, the style of that area heavily rely on the #description_board is and few others, so borrow the style is impossible unless I duplicate the id making the markup invalid.

Would it be so terrible to rely only on classes?
Bugs creator.
Features destroyer.
Template killer.

Re: Classes, ids and styles organization

Reply #1

When I'm writing themes I only use classes for the same reason,  so I can reuse them later on and prevent from having invalid W3C check.