What is divitis?

By John Faulds

'Divitis' is a term used to describe an error common amongst newcomers to building CSS-based sites whereby they use too many divs for everything.

Divitis is related to 'classitis' and 'span mania', both terms used to describe the practise of combining spans with a class to style content when a more appropriate tag is available, e.g. <span class="heading">Your heading</span> instead, of course, using a heading tag: h1 - h6.

They are all different terms for using tags improperly and not choosing the tag with the best semantic value.

You see the worst cases of divitis when someone is making their first steps away from creating layouts with tables, but still thinking in tables mode. In these cases, you'll often find every single <td> has simply been replaced with a <div> which is, of course, no better and carries no more semantic meaning than laying out using tables.

So what's the cure for divitis? Obviously, using the right tag for the right content, but what if you don't know what that is? Well, as in medicine, prevention is probably better than a cure, so thepineapplehead at CSS Creator has provided an example of a selection of code suffering from this web-borne affliction and shows how it could be better marked up.