Div tags VS table tags

Hello all.   I would like to know what some experts on EE think about using the Div tag.  Does it affect performance VS using straight table tags.  Are there any real disadvantages using them at all?  I have not seen any disadvantages but I would be curious to see others response.  Thanks all
sbornstein2Asked:
Who is Participating?
 
ChokeholdConnect With a Mentor Commented:
I'm quite familiar with the ease of using tables in page layout as I've used this technique before However, one of the main reasons why I switched to divs is not because of the design possibilities that come with it, but because it's the right tag (semantilcally) to use when defining the structure of your html document. Tables were meant to be used with tabular data like this:

<table summary="Pets and their owners">
 <tr>
     <th>Pet Name</th>
     <th>Species</th>
     <th>Owner</th>
 </tr>
 <tr>
     <td>Byte</td>
     <td>Dog</td>
     <td>Geeky</td>
 </tr>
 <tr>
     <td>Snap</td>
     <td>Fish</td>
     <td>Rose</td>
 </tr>
</table>

whereas div is used to organize elements into meaningful chunks like this:

<body>
 <div id="navigation"> ...some elements.. </div>
 <div id="maincontent">
    <h1>Welcome!</h1>
    <p>This is the main content</p>
 </div>
 <div id="footer">
 </div>
</body>

Overall: Tables makes things easy, but divs are the way to go.... Don't see other disadvantages apart from the structure ...
0
 
ThogekConnect With a Mentor Commented:
Chokehold hit the basics on the head, so I'll just add a few less prominent (and, in most cases, relatively minor) notes...

Some browsers may take longer to render if many tables (especially tables-in-tables) are used, as the number of rendering objects (tables, rows, cells, tables, etc.) is greater.  The only browser I recall having a serious problem along these lines was Netscape 4.x (which could be sent into a serious tailspin while trying to load a page containing too many concentric tables), which is thankfully an uncommon browser these days (and later versions of Netscape don't have this problem so much), so this is likely a minor effect in all but the most table-berserk of layouts.

Depending on your CSS usage, div-and-CSS usage may also allow you to include your content in your HTML document in an order than is irrespective of their position and flow on the page.  This can be somewhat beneficial from a search engine optimization (SEO) point of view, as some search engines (such as Google) tend to place a bit more weight on keywords in content closer to the beginning of the HTML file (although how much of an effect this is is debatable).  So, in this method (and assuming the appropriate CSS approach), you can put your page's real content first in the file, regardless of where it actually appears with respect to headers, ads, navigation links, etc.
0
 
sbornstein2Author Commented:
Thanks guys.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.