Written by Harry Roberts on CSS Wizardry.
Table of Contents
- Insemantic code
- Insensible code
- Semantics concerns itself with elements…
- Be sensible, for our sake
- Final word
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:
About
This is some page text about some stuff...
Insensible code
This code is perfectly semantic, it just uses some silly classes:
Semantics concerns itself with elements…
…and not the names assigned to them. Using the correct element for the correct
job is as far as semantics goes. Standards concerning naming of those elements
is all about sensibility.
Semantics sets a standard from which it is very difficult to stray. Headings are
marked up with a
, a list with and so on. You cannot,
however, define a convention for naming the IDs and classes of these.
Leave a Reply