PHP ZCE mock test, interview preparation, daily lessons under chalk talk

Tuesday, June 5, 2012

Difference between div and table


What is the difference between a div and table? When will you prefer one over the other?

1. Tables are quite acceptable for displaying layout elements that are in a tabular layout format. On the other hand, divs do not restrict the layout to tabular format. Instead, a div is like a “floating box” that can be positioned anywhere you want.

2. Divs helps seperating content from presentation.

3. Table make it more difficult for the search engine to find relevant information.