9

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?

1
  • 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, 2011 at 2:11

4 Answers 4

13

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.

5

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.

4

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.

-2

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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