I want to know which structure is better a div
or a table
with respect to the performance. It is difficult to work with divs
rather than table. Then why use divs
instead of tables
and also tell me where we should use tables
and where the divs

- 5,753
- 72
- 57
- 129
-
2Similar: http://stackoverflow.com/questions/2617895/actual-table-vs-div-table – rwilliams Mar 08 '12 at 06:46
3 Answers
Donald Knuth was once quoted as saying:
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.
With respect to your question, in all but the most severe edge-cases where you cater to slow connections on archaic browsers, I would say the difference between divs and tables (in performance) is something that should not even be considered a factor.
Now, you say that it is more difficult to work with divs rather than tables (I thought so too when I started), but as you learn more css and how it works, you may have a change of mind. Divs+CSS are actually incredibly easy to work with and most importantly make your code maintainable, something that tabled layouts can never achieve (IMHO). Using Divs+CSS will--in the long run--save you a tremendous amount of time programming.

- 9,033
- 5
- 44
- 67
-
I agree fully. Once a web-page reaches a certain size and complexity, if it is designed using tables, you will end up with tables inside tables, and complex hierarchies of `
` and ` `-tags which can be a nightmare to modify. A well-planned system of ` – Kjartan Aug 24 '12 at 14:09` tags and CSS will make such a page so much easier to read, understand, and modify in the long run. As for performance, I doubt the difference is very great. If I was to hazard a guess though, I would think using `` is more efficient, simply due to the greater complexity of tables. -
1Potential red herring. The question is asking about the performance impact. how small the impact is is not relevant. If there is a performance difference, it is interesting to understand what it is, and what causes it, as well as whether or not the reasons for this are temporal(eg, we don't know how to make efficient tables yet, but we might in the future) or inherent(eg, divs will always be faster than tables because of x...). Your answer is regarding maintainability rather than performance, which is a different question(are divs more maintainable than tables?). – Dmytro Jun 09 '16 at 20:07
divs using un ordered lists with list items will give you cleaner code that you can maintain and upgrade for the future. also divs make better use of css which gives you more flexibility for styling and integration with javascript. I never use tables and dont see any advantage to them.

- 4,593
- 8
- 56
- 91
-
Well, they can be useful in *one* situation: When you want to present tabular data. ;) (Typically report-data, schedules, etc.) To quote a good friend: "Tables should be used for tabular data, and nothing else". – Kjartan Aug 24 '12 at 14:02
Div is very simple. It will be easy to create complex structured web pages with div.
It would be great to use table for creating tabular data. For structuring a webpage I prefer Div Tags.

- 4,340
- 1
- 22
- 31