Ehsan Tavakoli

Writing About .NET Programming and other stuff

Archive for the ‘Uncategorized’ Category

Using DIV instead of TABLE

leave a comment »

DIV tag really has more flexibility in page layout than table. You can simply put a div in any sections of your webpage. Moreover, you can move or edit your div with AJAX technology easier than table.

In other hand, div tag produces fewer characters than table. Like that:

<div>
</div>

And:

<table>
  <tr>
    <td>
    </td>
  </tr>
</table>

Therefore, it will help you to diminish your page source character and let it to load faster.

Then another reason that’s why it’s better to use div is for CSS. You can modify your div sections by CSS much easier than table tag.

Now, with all these good features you may wonder why they have created table at all. Designers in W3C have made table tag for creating tables (in context) and also for making tabs. Table tag is easy to use and time effective and can be used for implementing tabs so much faster and cheaper than div tag.

Here is the list of div features:

• Less weight in page size

• Higher Page Rank in Google and other search engines

• Higher Flexibility

• More control with CSS

I’m strongly advising any developers to use div instead of table in your designs. Eventually, let’s check out this website: http://www.csszengarden.com which has been designed with div codes and you can easily change the whole design by clicking the links on the right menu.

In the next few posts, I’m going to write how to use div in your design….

Advertisements

Written by Ehsan Tavakoli

February 10, 2010 at 3:58 am

Posted in Uncategorized