Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: CSS Tables

  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Location
    USA
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question CSS Tables

    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.
    Last edited by ssskaya; 02-12-2004 at 08:30 PM.

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    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

  • #3
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    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...
    Code:
    <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?"
    Code:
    <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

    -Rich


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •