Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I started to code HTML in 1998, and in that time I used a lot table tags, playing with tr and td, I learned many things analyzing the source code of many portals on the internet with notepad and Microsoft FrontPage, the latter, aw, how many tables overlapping others, it was fun, I loved that time.

However, I abandoned web programming for almost seven years and this year I decided to see what web programming is like today. It seems completely different, as most sites do not use table tags, and instead use div and span tags.

Why did this happen? What are these new tags and why are table tags no longer used?

share|improve this question
5  
Same reason why you probably use Windows 7 instead of Windows 2000. Technology evolves. Table tags are still around but they are used for what they were originally intended, tabular data not page formatting. –  Chris_O Dec 2 '11 at 2:11
add comment

5 Answers

The World Wide Web Consortium (W3C) developed the first Cascading Style Sheets specification in December of 1996. Cascading Style Sheets (CSS) have since radically evolved and made the separation of HTML content from presentation data more common among popular sites.

Though present-day sites may still rely upon inline style declarations to achieve desired effects, it is far more efficient to include presentation data (element height, width, padding, margins, absolute positioning, etc) in a single CSS file referenced by multiple HTML documents than to update every instance of the HTML content when presentation needs change.

Browser adoption of CSS did not occur overnight (which is why some major sites still relied upon tables to achieve uniform presentation across a variety of browsers well into the 2000's) and, while some browsers continue to differ in their implementation of W3C CSS specifications, graphical browsers which do not support CSS1 are very uncommon, so very few popular sites rely on tables to achieve cross-browser compatible presentation.

The 12 Lessons for Those Afraid of CSS and Standards article (published in 2006) at A List Apart and a review of the W3C's CSS Snapshot may be a good starting point if you would like to catch up on the transition from table-based layouts to CSS.

share|improve this answer
add comment

Without getting into an entire history of web dev evolution...
Tables were never meant for doing page layout; this is the most important bit. Using them that way was a workaround brought about by the technology of the time, both incomplete specs and incapable browsers. Eventually those issues were (mostly) addressed and now it's not really necessary anymore.

The SE sites are generally for more practical questions, eg. how do I... but if you want more detail, many beginner-level HTML books–and it does seem you're starting all over–have a condensed overview of what you're asking about as introductory material.

share|improve this answer
add comment

Tables still exist in html spec. But they should be used for displaying data in a tabular form! (Although table markup has evolved somewhat, with column and group labels somewhat easier to apply in a sensible fashion).

If you have pictures and news content you want to write up for a webpage, you should stay well clear of tables for the reasons outlined by other people answeing this question.

If you want to display a months accounts in a page, then by all means, you should be using tables to do this.

share|improve this answer
add comment

Not nobody, a few years ago (and still, if you support IE 6) tables were the best choice to assert same layout for all browsers.

Frameworks that refused to used tables to do layout, like Ext, ended calculating dimensions dynamically via changing styles on resize, which maked them work buggy on some browsers (IE 6 mentioned before).

Tables are still used as basis for grid layouts in various frameworks (Icefaces e.g).

share|improve this answer
1  
Not just IE6 - the "Word HTML" markup that office uses means that if you want to send "pretty" HTML emails to Outlook you need to use Tables. –  Zhaph - Ben Duguid Dec 2 '11 at 10:46
    
HTML emails are the exception, but there are non-JS workaronds for most IE6 glitches without resorting to table-based layouts. –  Lèse majesté Dec 6 '11 at 7:49
add comment

I secretly still use them.

Most importantly they are still in HTML5: http://www.w3schools.com/html5/tag_table.asp. So it is perfectly safe to use them for your twisted layout needs.

Edit: (After being down-voted a bit) A great example of a "twisted layout need" is to use tables in your mass e-mails. If you want your junkmail to look as sexy as the promised effect of your product, you can't use most CSS.

I don't always use dirty hacks, but when I do I prefer hacks that will last for the next ten years.

share|improve this answer
2  
-1 Tables should not be used as layout aids. –  Su' Dec 1 '11 at 13:48
4  
@Misha You're linking a horrible source, see w3fools.com –  Lekensteyn Dec 1 '11 at 15:50
1  
Horrible advice. Your holding the web back. Table tags are for tabular data not page formatting. –  Chris_O Dec 2 '11 at 2:14
    
Twisted layout needs? That's what absolute positioning and a myriad of Z-indexes are for. –  CC Ricers Dec 6 '11 at 2:20
    
Your edit has a good point though. Sending proper HTML emails will always require tables. –  Stephan Muller Dec 6 '11 at 9:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.