A popular question that has been burning in the web design community for a while now is “Which is better to use when building a website: tables or divs? While this is a debatable question, the most correct answer is – it depends on the website.
Most purists prefer divs due to the accuracy with which you can place items on a page, and the ease with which you can then change the layout in CSS.
Tables, as their name suggests, are designed to display data in table format. If you are listing, for example, a library of books in a simple fashion, a table will do nicely. Equally, when dynamically loading data from a database, a tabular structure has traditionally been used.
Advantages of using Tables over Divs
Here are some of the advantages of using tables over divs in web design:
- Older browsers will support them
- Can be much quicker to develop for simple websites
- Data-intensive websites that need to have a certain degree of compatibility with spreadsheets can easily be created using tables so that users can copy and paste the data
Advantages of using Divs over Tables
Divs also have their advantages, and generally speaking a pro for one is a con for the other.
- Divs translate to smaller page sizes. Smaller page sizes mean fast-loading websites
- You can accurately design layout elements using divs to ensure cross-browser compatibility
- Designs built using divs are easier to update by using CSS
It is a popular belief that divs are more search engine friendly. This is arguably correct due to the smaller page sizes and fewer tags. This way, search engine spiders don’t have to crawl through excess tags to get to the content. The increased load speed could also have an effect on search engine friendliness
Generally speaking, divs outweigh tables when it comes to website design and layout. So most developers will always go for divs. The extra time spent on tweaking the page layouts means that visitors can have the same experience regardless of the web browser they choose.