...

View Full Version : CSS Tables



ssskaya
02-12-2004, 08:40 PM
What is the difference between setting the width in the <td tag and settting it in the <style tag?

Do they not apply in the same terms just as the color, font face and else?

why is .css considered a better choice?

thanks.

rmedek
02-12-2004, 09:36 PM
The idea behind the depreciation of width in <td> (and <img> and others) is the move towards separation of style and content. The content of a page is in the xhtml, and the presentation is in the css.

It's very helpful when updating or redesigning pages. Let's say you have a ten page site, and tables on each one (hopefully not for layout :)). Then you decide you need to make the first column on each row 10px wider for whatever reason. Rather than going to each page, sifting through your content, and changing "<td width="#px"..." , you go to your stylesheet once and take care of it all.

The same goes for updating pages... rather than sifting through "<font face....><table><tr><td.....><img.....>content</td></tr></table></font>" to get to your data, you go to your xhtml.

<p>content</p>

fantastic. plus it helps search engines, and makes pages more accessible, etc., etc.

Hope this helps...

-Rich

rmedek
02-12-2004, 09:47 PM
oops, there's more...

The big thing is CSS helps you code your pages semantically. For example, let's say your page looks like this.

Welcome!
This is my webpage! Thanks for coming!

You could code it like so...
<html>
<body>
<font face="arial" size="1"><b>Welcome!</b></font><br>
This is my webpage! Thanks for coming!
</body>
</html>...or, you could code semantically. As in, use the tags of html to do what they were designed to do... I like to think of semantics as "what makes sense to use here?" :)

<html>
<body>
<h1>Welcome!</h1>
<p>This is my webpage! Thanks for coming!</p>
</body>
</html>

Semantics is a huge step in the advancement of the web, especially in alternative sources of rendering, like pdas and cell phone, to say nothing of accessible devices.

Ok, my little pitch is done :D

-Rich



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum