How bad are tables, really? - TechRepublic
General discussion
February 26, 2009 at 07:36 AM
techrepublic

How bad are tables, really?

by techrepublic . Updated 17 years, 3 months ago

I know tables are being phased out, but I’d be lying if I said I never use them anymore. It was about a year ago now that I finally “grew up” and started using the span and div tags, then css.

I’ve been using tables for many years now, so it’s not always easy to replace them with the proper methods. I can’t think of a case right off-hand, but I’ve had times when I wanted to have pieces organized around other pieces in such a way that I knew how to do it with tables, but couldn’t seem to figure out how without them, so I did it the way I knew. Usually it’s because I want thing in certain positions relative to other things, but the widths adjusted with screen size. If you want everything in a specific position and a specific size, it’s easy with divs, but then when you want them to adjust to the visitors screen, it gets trickier.

Using tables with rowspan and colspan tags, you can get quite sophisticated with positioning things, and even mixing absolute and relative positioning, and it displays the same on most browsers. I’ve had times when I would try using style tags with absolute and relative positioning to get the same result and IE and Firefox would show 2 different results. Stick’em in tables and they’re both happy, or at least showing the same.

Centering images…
Used to be so simple. < img align="center" src="" >
Now it’s supposed to be:
< style type="text/css" >
.centeredImage {
text-align:center;
margin-top:0px;
margin-bottom:0px;
padding:0px;
}
< /style >
then
< div class="centeredImage" >< img src="" >< /div >

Even just sticking the image in a centered table with 1 row and 1 column seems simpler.

I know with style, you only need the style type once and then you easily center many images, but it just seems like too much to just center 1 image.

CSS has been around for a little while now, but according to log files of some of my more active sites, about 5% of visitors are still using older browsers that won’t fully comply with today’s CSS. I see that as just another reason to continue with tables, at least for another year or 2.

How many people still use tables to get the layout they want? How much longer can tables be safely used? What’s your opinion on getting rid of tables? When will 99% of surfers be using CSS2 browsers?

I personally like the idea of separating content from layout, but if you want everyone to see a page properly, it’s either complicated coding for different browsers, multiple versions of each page, or sticking with the tried and true code of the “old days” until the old browsers and OS’s are all gone.

This discussion is locked

All Comments