fARcRY fARcRY - 2 months ago 12
CSS Question

<div> element instead of <table>?

Duplicate of:






Theres been a lot of talk lately about rather using div than table tags to make your pages more browser fiendly. Why is div better?

Answer

a few reasons:

1) div is more semantically correct in most cases. people who code their sites in table structure aren't using tables for what they're made for, which is tabular data. divs represent a "division" or a section of the page, so putting items in divs is more correct.

2) divs are more flexible and easier to style and maintain. you don't have to write <table><tr><td>Text here</td></tr></table> every time you want to say something when you can just write <div>Text here</div> instead. you can add css hooks (ie, classes or elements) to both tables and divs, but with divs it is infinitely more flexible.

3) table structured sites are just plain ugly :)

Comments