PDA

View Full Version : divitis?!?


gentleone
11-18-2009, 01:02 PM
divitis?!? :roll:

When I started developing with divs and css, I used to wrap almost everything in a div. Hey... that's what they said on the net: "Don't use tables for your layout, but use divs and css!!!". Okay... So there I went with my divs, but the trap you can easily fall into is to use a div while it's not necessary. The use of too many divs is named divitis and is not coding clean & semantic.

The following article from WebDesignerWall give some good tips about styling a <p>, <ul> or <h1> tag with the same result as you would wrap it in that unnecessary div. Very handy article if you just started out with divs and css.

coding clean and semanti (http://www.webdesignerwall.com/tutorials/coding-clean-and-semantic-templates/)c

domedia
11-18-2009, 03:35 PM
The rule of thumb is to use the HTML elements the way they are intended.
Do you have a block of text, wrap it in a <p>
Headers, use <Hx>
You got your address on your page, use <address>
etc

Then use DIV's and SPAN's for neutral html elements that you can hook CSS to.