CSS vs. Tables, I don't understand

jag5311's picture

They have: 202 posts

Joined: Jan 2002

I have read on here and on the web of people using CSS instead of tables. I don't understand. I thought tables were a necessary part of a website. I thought CSS was only a way to alter the characteristics of a table and a website(i.e, borders, color, opacity, repeat, no repeat, links, hover, ect..)

Can someone give me an example of a website built from CSS only and that contains NO tables. I just need some clarification on this.

Thanks
Bryan

Busy's picture

He has: 6,151 posts

Joined: May 2001

CSS can be used for entire web sites, but it does have a few problems with certain browsers (nothing new there). As browsers advance more and more CSS will beabled to be used. but for now tables are a safe way to go, plus tables wont be phased out any time soon, but will be aimed at data rather than layouts. a couple of my own pages

no tables
tables

and/or

no tables
tables

note: second examples have compatiblity issues.

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

I think everyone is slightly getting the wrong end of the stick as far as this issue is concerned. As Busy says, tables aren't about to become invalid and they will still work and are a valuable asset for the design/layout process.

You can use CSS to achieve layouts but I think for most people it is much better to use CSS for presentation only at this time until they get to grips with that side of it first (myself included!) and then once they fully understand the concept of CSS and what it is capable of then move on to the next step.

Julia - if life was meant to be easy Michael Angelo would have painted the floor....

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Julia's right -- although if you're brand spanking new to the web, I'd encourage you to start with CSS positioning, as it will be easier to learn that straight off. People who learn how to use tables for layout have to unlearn that way of thinking to learn how to use CSS positioning.

The problem with using tables for layout is that it traps the content in the display, which renders it oddly for alternative browsers, and requires that it be edited in the future (instead of the design or layout being edited). If you use dynamic scripting or databases to create your website, this is less of an issue, but without careful care, the tables can still render a website less accessible and less usable to alternative browsers.

My experiment site: http://secrets.synapticimpulse.com
My blog: http://www.synapticimpulse.com

Both of those use CSS positioning, the blog has done so for well over a year. If you use N4.x, you'll get a different layout, and a note at the bottom explaining why. Additionally, there is extra navigation if you're using a browser that doesn't handle CSS positioning well.

hth!

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

It's also important to note that tables were never meant to be used for layout, just in the way that HTML was never meant to be a presentation (which is basically why CSS was invented). So, just in the way that HTML is limited terms of its ability to present visual information efficiently, tables are limited in their ability to create a layout.

Another good site to check out is http://www.alistapart.com - they've got lots of articles on how to do things with CSS, and their site itself is entirely done in CSS as well so it's a good example of how to do things. Unfortunately, there aren't a huge amount of tutorials out there on how to do this, at least not from a beginners perspective, so it takes some figuriug on your part and viewing source to get things to work right. A List Apart , the site I linked to earlier has some good stuff (paarticularly one article that describes how to use float: to get a flexible layout)

They have: 344 posts

Joined: Jun 2002

Welcome to the club Bryan!

It is all these women! They have too much learning time and not enough working!Wink

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

The cheek! Wink

jag5311's picture

They have: 202 posts

Joined: Jan 2002

Thanks Everyone. I appreciate all the comments.

Busy's picture

He has: 6,151 posts

Joined: May 2001

Quote: Originally posted by Timewell
... It is all these women! ...

Hope I wasn't included in that, Busy is a male

They have: 344 posts

Joined: Jun 2002

Quote: Originally posted by Busy
Hope I wasn't included in that, Busy is a male

*whistles past*

:eek:

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Some of us women, no wait, all of us women do this for a living, bub. Be thankful we take time out of our days to answer questions! Wink

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

Well said Suzanne! Wink

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Now Timewell, you don't want us ladies to start a male bashing contest do you? Laughing out loud

You know we would win. Sticking out tongue *snicker, snicker*

Busy's picture

He has: 6,151 posts

Joined: May 2001

just to go back to the topic for a sec Wink tables can be floated (contoled by CSS) so youd have three choices, tables, tables with CSS and CSS by itself

They have: 344 posts

Joined: Jun 2002

Quote: Originally posted by disaster-master
Now Timewell, you don't want us ladies to start a male bashing contest do you? Laughing out loud

You know we would win. Sticking out tongue *snicker, snicker*

Yeah sure I would! Men can easily win!

*Hides behind pillow*

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.