Forum Moderators: not2easy
I am currently redesigning my main business website in CSS. Is it acceptable to include tables in a CSS based site? I know that the purists will frown upon this but in the real world will it cause me any problems?
But I have coworkers that feel CSS won't last much longer. They say the standards that W3C is trying to push will not succeed and that eventually something else will come by and sweep us off our coding feet, leaving CSS in a pile of unsuccessful layout languages.
I feel that they're just too scared, or lazy, to learn how to use it. So I'm stuck using a table to layout pages. Although I'll sneak a few of my own in there, and no one will be the wiser (I hope).
Layout = no!
I wish I could agree. I wish the practical production world allowed me the development time it takes to do all-css layouts.
My company tried last year - but the browser support is still so very quirky, that unless you stick with a few proven templates and keep re-using them, or have a client with deeper pockets than most of ours have, a basic layout that's held in place with a table still makes practical sense to us.
I've often written how I admire those who are willing to slog through what it takes to find all the hacks needed. You all are pioneers and very much to be praised. After trying the all-css appraoch for 10 websites or so, my company just had to cut our losses and use a basic layout table with everything else in css. We write validated (usually) and strict mark-up - and tables still do validate after all!
The future for us depends on how IE7 works. If it's close enough to standards, I'll be joining the CSS-P gang in a few years. Until then, I have an income to earn, so pragatism trumps semantic purity for me.
..or have a client with deeper pockets than most
Most clients don't care whether or not you use CSS or tables. Just as long as it looks right on the screen that they are looking at it from. But in your own mind you feel a bit of self satisfaction if you are able to pull it off accross all browsers within a given time frame.
I have an income to earn, so pragatism trumps semantic purity for me.
At this point it supplements my income, but I can understand where you are coming from. Less clients are willing to shell out the extra dough for the time it will take you to debug their entire site. Once its done though, how great it feels.
Any more opinions?
We all hope to attain a higher level of existence, in both HTML and spiritually, if we don't get there - at least we keep trying. :-)
I am a self-confessed table junkie. I try at every opportunity to create tableless layouts, and if I can, I do, but often fall back to tables, as an alcoholic falls off the wagon. But I get it done today.
A hack is a hack; if you have to hack CSS to force it to do what you want in all browsers, in my opinion it's still a hack, as a table layout is a hack to attain the same goal. In this aspect, which is easiest and fastest for you?
My final deciding factor rests with some recent sites that required 508 guidelines compatibility. For those that don't know, the 508 guidelines (paraphrasing) were established in 1997 to assure accessability to all users: blind users that require "readers", those who cannot use a mouse, etc.
I am aware that CSS/tableless layouts and the 508 guidelines are two separate issues, but in respect to tables, they go hand-in hand. Sites that require 508 compliant pages will almost always require the following (again, paraphrasing:)
Don't use tables for layout; but if you MUST use a table layout, insure that the data, as read by a reader, follows a logical order, and USE the summary attribute of the table to describe its contents. DO NOT nest tables inside tables; tables should be only one layer deep.
This means: The summary attribute announces to the reader ("reader" as in software, to read a page aloud to a user) the FUNCTION of the table: "layout table for main page content" or "results table for 2005 races." As for logical order, readers read tables in ROWS. They traverse one row, and proceed to the next. If your data/images follow a logical order when read this way, it will pass.
If you pull the funky trick of using tables to put content near the top of the page for search engines, but near the bottom of the page VISUALLY, this may not only confuse the "reader," it may fail 508 guidelines by not being a logical order.
So. I say, yes, tables are acceptable even if it's not quite Zen, but do your best to keep growing. :-)
That said, I personally never use tables for layout. I've written here in the past that I believe the primary difference between those who use tables and those who don't is merely a question of background. Many designers started out using tables and find the switching over tricky (I believe rockinbill fits this description, yes? ;)). In my case, I started out with CSS and find myself in a flip-flopped situation: I wouldn't be able to design a page with a table if my life depended on it. In fact, when I NEED a table for tabular data, I have to immerse myself in the W3 specs in order to figure out how to structure the thing.
I'm a HUGE fan of clean and valid code, and believe very strongly that what others call the "limitations of CSS" are not, in fact, the barriers that many think they are, but when it comes down to it and there's a client on the phone wondering where his site is, the reality is that you should use whatever reliable tools you have at your disposal to get the job done.
Believe me, by just asking the question, you're guaranteed to build a cleaner, leaner site than 80% of the schlock out there. :)
Use your table with CSS and feel no shame (but do as much of it as you can with CSS, because purists aside, CSS just rocks.)
cEM
1. That it is always necessary to employ hacks.
It just isn't. I do fully CSS layouts all the time - never, ever used a hack and they work in all browsers and degrade nicely.
When I started using CSS they were not so great and a few of the old ones are around to haunt me still, but once you realise what is and is not possible without hacks it is easy to avoid them.
2. That designing with CSS is somehow slower and more labour intensive
The exact opposite is the case! Once you have say 3 or 4 layouts that you have used in the past, it takes no time flat to edit them and whip out a new and competely different design.
Case in point just today.
I have a site with in excess of 1500 pages whose layout has been annoying me for a while mainly because it made it difficult to position AdSense the way I wanted and to use some of the ad formats I would like to use.
Today was a quiet one, so I redesigned it - a completely and utterly different layout, it looks nothing at all like it did before. It took me about an hour and a half. Just edited the stylesheets, altered two or three include pages, zapped them up and job done.
That would certainly have taken a lot longer without a CSS layout, I moved stuff from left to right and so on with no hassle.
I did wonder what anyone browsing the site at the time must have thought - you hit a link and the whole world changes :)
It took me about an hour and a half. Just edited the stylesheets, altered two or three include pages, zapped them up and job done.
That is only because you properly styled the pages when you first designed the site!
---
It IS possible to design a site without hacks! However, my guilty pleasure is the *html body hack. The only thing that feels better than using a few extra lines of code to make IE purr, is designing a site that doesn't need it.
I have yet to reach that level. When I do though, I will happily become a full member of this forum. Hands down, this forum has become my number one resource when it comes to anything web related.
Many designers started out using tables and find the switching over tricky (I believe rockinbill fits this description, yes? ;)).
You would be correct - HOWEVER when CSS was first making it's debut, it did so at a time when I was beta-testing for an online school and one of the courses were - you guessed it - CSS1. So CSS has always been a tool kept close to the Notepad. :-D
To clarify, when I say "hack," I mean things like the Holly hack and other workarounds to the MSIE box model issues.
This is not a matter of being a purist, but plain common sense, and I have absolutely no doubt that this is the way to go. But to answer the original question... tables, not DIVS, are often the correct way to present tabular data.