{"id":19277,"date":"2012-11-27T09:48:04","date_gmt":"2012-11-27T16:48:04","guid":{"rendered":"http:\/\/css-tricks.com\/?p=19277"},"modified":"2017-03-26T13:39:12","modified_gmt":"2017-03-26T20:39:12","slug":"bad-code-dogmatism-etc","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/bad-code-dogmatism-etc\/","title":{"rendered":"“Bad Code”, Dogmatism, etc."},"content":{"rendered":"
Harry Roberts expounded upon my answer with lots more specific examples about bad things you can find in CSS (e.g. magic numbers, qualified classes, too vague of selectors). Harry says in this article:<\/p>\n
Use IDs in HTML for fragment identifiers and JS hooks, but never in CSS.<\/p><\/blockquote>\n<\/li>\n
- Jeffrey Zeldman reacts to this and defends using IDs<\/a>. Jeffrey compares abandoning ID’s to OOCSS and avoiding descendant selectors.<\/li>\n
- We have Jeffrey on ShopTalk<\/a> to discuss. We don’t spend too much time disagreeing – but instead focus on a much bigger agreement: being too dogmatic about these things is the worst possible stance.<\/li>\n
- Totally coincidentally, we have Harry Roberts on ShopTalk next week.<\/li>\n<\/ol>\n
Now my turn again. I love blogging.<\/p>\n
I feel like if anyone gets off-put by Harry’s writing, this article or any others, it’s that he sometimes comes off as being dogmatic. If that term doesn’t mean anything to you, just think of it as inflexible thinking. This is the way things are dammit and that’s that. Having strong opinions is awesome, having inflexible ones is not. Writing about what works for you is awesome, writing iron-clad manifesto’s is not.<\/p>\n
I’ve met Harry. He’s a nice guy. I’m not sure how dogmatic he is in his thinking (I doubt much). We’ll talk about that on ShopTalk.<\/p>\n
Jeffrey called “bunk” on the decree that ID’s should never be used:<\/p>\n
Say it with me: There is nothing wrong with id when it is used appropriately (semantically, structurally, sparingly). There is plenty wrong with the notion that class is always preferable to descendant selectors and semantic, structural ids.<\/p><\/blockquote>\n