--- comments: true date: 2010-08-09 16:34:46 layout: post slug: semantics-and-sensibility title: Semantics and sensibility wordpress_id: 1309 categories: - Web Development tag: - HTML - Markup - Semantics --- For a while now, sensible naming conventions and semantics have been confused. Things such as `class="left"` or `class="clear"` have been deemed insemantic, whereas in reality, semantics really doesn’t stretch that far… Let me illustrate with some code examples: ## Insemantic code The following code is just plain wrong, it’s insemantic, using the wrong elements for the wrong job:
I like to keep my markup as lean as possible, and I know what `a`, `b` and `c` do.While this is all correct, and passable, it’s not really very sensible. He might know what `a`, `b` and `c` do, but what about the person who inherits the project? For all his justification of code bloat was somewhat advanced (_really_ decreasing markup size), the impression the next guy to see his code will have will be ‘WTF was this guy thinking?!’ Always code like you’re working in a team, even when you’re not. ## Final word
Semantics and sensibility are not the same. Anyone who tells you that `class="left"` is insemantic is wrong. Be semantic and be sensible. Pick names which are descriptive. An ID/class should be as short as possible but as long as necessary.An ID/class should be as short as possible but as long as necessary.
Jens Meiert