Tables - and what not to do with them.
When first learning basic html, you will probably come across tables. At first sight you may think that creating a website of
tables to layout your website is a great idea. Unfortunately today, with CSS gaining ground next to html, we now have a better alternative.
Using CSS is superior to tables when dealing with layout, and this is why.
Why CSS is better to use:
- Tables are usually more bytes than CSS
- Longer to download, so it is slower to display in your browser.
- Tables usually prevent incremental rendering
- Images can't load a little at a time, making the users wait.
- Tables can require you to "chop" a bigger image into smaller ones.
- For the sake of layout, you might have to separate a big image into smaller ones to make everything align.
- This makes the file size larger, and slower to load.
- Tables can prevent some layout features from working within them.
- Tags like height:100% won't work.
- This can limit what you can do inside of a table.
- Tables take longer to impliment than CSS
- Although CSS takes time to learn, it will be quicker to use than tables.
- Tables should describe content, not presentation.
- CSS should be used specifically for presentation, while HTML for content.
- Tables are horrible for people using screen readers.
- You would help the blind or partially sighted to understand your website.
- This makes your website more accessible to everyone.
- Tables make it harder to redesign.
- If you use tables for layout, you are pretty much "locked in" to your design.
- Using CSS, it is very easy to change any aspect of your website.
Why are tables better to use?
- ...um... that's a tough one...
- Reading all of the above about CSS, why would you ever want to use tables again?
To be fair however, tables aren't all that bad. Like I said in point 7, tables should be use to describe content. If you had a list
that you wanted to put in your website like below, that would be fine.
Name |
Address |
Phone# |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
For that reason, it is a good idea to use a table to organize your content. However, as I stated before, it's not a good idea to use it
to design a website.
Some more sites to check out
http://phrogz.net/CSS/WhyTablesAreBadForLayout.html
http://kimihia.org.nz/articles/tables/
http://wordpress.org/support/topic/77912