Some reasons for div-itis:

1. Columns. "table cell => div" is wrong, but usually "columns => divs" is 
correct.

2. Boxes. The designer wants to put a box around a group of items. There might 
be a heading, a list or two and a paragraph, with border and a background. You 
could do this without a div (for example, by setting side borders on all the 
items, and a top and bottom borders on the first and last items respectively), 
but it's easier to just wrap it in a div and give it an id and a single style. 
And since box = section = div, it's the correct thing to do anyway.

3. Multiple backgrounds.

4. Expandability. Sometimes you know you have only one item in a box or a 
column, and you know you don't need a wrapper div. But you can bet that in a 
couple of months the designer/editor/cleaner will want to add a more items. So 
you build the structure to grow.

5. Box model work-arounds. You want to give an item a width, some padding and a 
border. You could use some CSS hacks, or you could just set the width on a 
wrapper div, and the margin/border/padding on the item itself. e.g. with 
columns, I set the width on the column div, then set the 
margins/borders/padding on the contents. 

6. Laziness and deadlines. Sometimes it takes a lot of effort to make things 
simple. Not always worth it.

cheers
--
Geoff Pack
Developer
ABC New Media




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Kenny Graham
Sent: Wednesday, 7 September 2005 9:31 AM
To: [email protected]
Subject: [WSG] td != div


In most of the previous table layout vs css layout arguments I've seen on here, 
people refer to "divs vs tables". Now, I never learned table based layouts, and 
don't understand them (spacer gifs, etc).  Because of this, I don't/can't think 
along the lines of "I'm replacing tables with divs".  But many of the XHTML/CSS 
sites I see clearly do.  For instance, they'll put a <ul> inside a <div 
id="menu">, just so that they can style the <ul>, instead of just giving the 
<ul> itself an id.  Or put the contents of a paragraph inside a <span id="p1"> 
instead of giving the paragraph itself an id of p1.  The only time divs don't 
make me cringe is when they're used to enclose a group of elements with the 
header that applies to them, and this purpose of divs is being replaced with 
<section>.  I know that divs are more semantically neutral than tables, but is 
wrapping an element in 5 divs and a span really that much better than wrapping 
it in a table? Hopefully this will start a debate that I can learn something 
from, since I have a limited background in tables.
******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to