?
Solved

Div tags VS table tags

Posted on 2006-05-04
3
Medium Priority
?
2,388 Views
Last Modified: 2013-11-19
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
0
Comment
Question by:sbornstein2
3 Comments
 
LVL 2

Accepted Solution

by:
Chokehold earned 1600 total points
ID: 16612878
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
 
LVL 15

Assisted Solution

by:Thogek
Thogek earned 400 total points
ID: 16620704
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
 

Author Comment

by:sbornstein2
ID: 16622995
Thanks guys.  
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will learn how to count occurrences of each item in an array.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question