Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Theme designers: Use CSS classes, not IDs.

gnawph wrote:

The bbPress designers would look foolish changing all of their IDs to Classes and wouldn’t conform.

I’ve already stated that: “I’m not advocating the removal of any of the ID’s from templates”. I am, however, conscious that the reliance on ID based formatting in the default template is more likely to run in to integration problems in the long run.

“Latest and Popular are different tables and shouldn’t be labeled the same”.

Yes, latest and popular are different tables (their ids are different), but they are both examples of a certain kinds of table that show an ordered selection of items based on some kind of score (be it date or rating). So it’s better to define what that kind of table is, so use a class.

“If code redundancy is an issue you could always go:#latest, #popular {

Yes, this does have a similar effect, but, if I’m writing a plugin with UI elements then for it’s output to be shown correctly in TemplateX, either:

  1. I have to add CSS to the plugin which might work with TemplateX, but be incompatible with TemplateY, or
  2. The authors of X&Y must alter their css to cope with my plugin.

This potential hassle just becomes less likely if template designers take an extra few minutes to consider what the more abstract classes in the design should be!

BTW: class="tableonmainpage" might be better described as .mainpage > table {}

Skip to toolbar