Which is best tag Div or Table?

Which is best tag for designing pupose :-
Div tag /Table tag

I think the best tag for design is div tag.

That’s an incredibly vague question, best for designing what? Tables are for tabular data, and divs are for any kind of block/division which doesn’t have a semantic meaning.

[font=calibri]It depends what you’re designing.

If you need to design a table then you use the <table> tag, innit.

If you don’t need to design a table and you aren’t still living in 1997 then I am struggling to comprehend what kind of thought process would lead you to think that using a <table> tag would be a sensible idea.

That isn’t to say that you necessarily need to use <div> either. Use whatever tag is semantically appropriate for the contents.[/font]

All current tags are equal except where one was introduced as a replacement for another.

There is no replacement for a <table> tag when used with tabular data.

Almost any other tag can be a replacement for a <div> tag as that tag is only intended to be used if there isn’t a more semantically appropriate alternative.

The new tags such as <header> <footer> <aside> etc are intended to reduce the need to use <div> by providing more semantically meaningful tags for many of the places where <div> used to be the only reasonable alternative.

The best tag is the one that is the most semantically correct to identify what it contains. The purpose of HTML tags is to semantically identify their content.

if by design you meant APPEARANCE or looks)… the answer is: neither. For that you use CSS to style the appropriate tags as desired.

Now what are the appropriate tags? well that depends on your content and its meaning…

if you have tabular data ( sequential content that relates to each other in a columnar way) then USE TABLES!!! other than that use P for paragraps, OL for ordered lists, UL for unordered list, etc., etc… and wrap DIVs around these to group them/ or as hooks for CSS rules.

hope that helps.

Thank You…

It depends on what you are trying to accomplish. <div> tags are more versatile and allow a bit more shaping and positioning than tables, as they are not stuck together like the table rows and cells.

Div tag is best when you compare in between Div and Table tag. Table tag can be used only for the content which should be in tabular form but Div tag can be used for any kind of content apart from table. As div tag can be used for everything like container, header, content, etc.

No it isn’t. You obviously haven’t read the explanations above.

The tag that best describes the content is the best tag. The div tag is the fallback for when there is no better tag.

It is like asking whether a car or a sandwich is best.

Why is using markup with divs defining everything (container, header, content, etc) BETTER than using tables? I understand that when you build your page using tables it: look ugly as hell, look even UGLIER when nested, because of the higher volume of ******** - slightly higher page load time, and less readable code.


The above comment is not this member’s own, but is copied from http://stackoverflow.com/questions/6118403/why-is-using-divs-or-spans-tags-better-than-using-a-table-layout I have not removed it, because two other members have provided good replies.

It isn’t.

You should only use a <div> tag where none of the other tags are appropriate.

You should use the most descriptive tag for what the content is. That means using <table> for tabular data, <p> for paragraphs, <ul> or <ol> with <li> for lists and so on. HTML 5 has introduced additional tags so that <div> is even less needed than before as now you can use <section> <aside> <nav> etc to provide even better descriptions of what the content is.

The tags you use have nothing to do with how the content looks and everything to do with what the content is.

Your page can’t look uglier using <div> rather than <table> or vice versa because neither has anything to do with how the page looks. That’s like saying that green or red makes you older and that when you were born is irrelevant.

Since 1997 CSS has been the way to define the way the page looks. Only in HTML 2 and HTML 3.2 did the tags have anything to do with the way the page looks (HTML 1 expected the browser to supply its own stylesheet to control appearance).

If you’re writing code like that, it shows that you haven’t understood the first thing about semantic code and tableless design. What lots of novices do is try to slavishly recreate all the table, row and cell structures with <div>s, which is not what it is all about at all. It needsa a different mindset, but once you understand how it is supposed to work, you can write much leaner, neater and more flexible code by avoiding layout tables.

Basically compare div tag with table, In some cases table are take high loading time than div. But for the better and easy alignment we can go for table.

I’m hungry so I’ll say sandwich

If you think using tables to style a page is easier than using CSS than I’ll bet you haven’t had to redesign many pages that used tables for layout.

Use divs. Tables render really slowly in browsers. Style wise no real difference if you’re any good at CSS.