website layout - divs or tables
category:web
14.09.2009
If you build a website yourself, you won't get past the problem of laying out elements on the page.
So the question is at first: what to use for layouts - div's or tables. Translated it means, to use CSS (applied to div elements or any other block-element in the page) or "table" tag properties to arrange elements on the page.
Since CSS was specifically designed to allow a simpler way to arranging page elements, you should use that. Sine arguments for it are:
- it allows a clearer separation between content, structure and interface rules
- a simpler structure: easier to maintain, easier to read - you'll find that using divs you will have much lesser div elements then you would have table, tr, td elements in the page - but also beware of the div-mania, the tendence to overuse divs
- many more options to change the appearence (thus also layout) of the page
Some arguments against tables are:
- table tags clog the html structure with their endless nesting; code becomes unreadable as tables are meant to store tabular data, and only that
- page loading times and order of loading of elements is far worst then in the case of divs
- tables are not seo-friendly
With the advent of HTML5 and CSS3 (standards?) the options you will have will be even better, so besides the fact that CSS is really pretty far from perfect, it's the best option we need to use.
Comentarii