SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: Table

  1. #1
    SitePoint Member
    Join Date
    Oct 2002
    Location
    mtl.
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Table

    I am showing a list of items and infos... that need to be in a table.

    I would like to know if i can specify the table cellpadding cellspacing using css? or do i have to give the style to the tr,td and the content of the cell to accomplish this?

    I want to do this for exemple with style:
    <table cellpadding='1' cellspacing'1'>

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    In your CSS:
    Code:
    table {
     cell-padding: 1px;
     cell-spacing: 1px;
     border: 1px solid #000;
    }
    An added benefit of styling your tables with CSS is that if you need a border it doesn't look like crap, like <table border="1"> does.

  3. #3
    .net install meltdown
    Join Date
    May 2001
    Location
    View Ridge
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You sure about that Vin?

    I believe the CSS equivalents are padding & border-spacing. You also need to take into account the border-collapse property, which complicates things a bit. Have a look: http://web3.w3.org/TR/REC-CSS2/tables.html#borders

  4. #4
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Yes, if you were considering HTML cell spacing equivalents using CSS for a <table> then consider 'border-spacing' obviously you'd have to use a browser that can render such CSS like Mozilla. Micro$oft probally wouldn't be able to render such code correctly. I've provided a simple CSS example.


    Code:
    <style type="text/css">
    <!--
    table {
     width : 100%; 
     border : 1px solid red; 
     border-spacing : 50px; 
     padding : 25px; 
    } 
    td {
     padding : 10px; 
     color : green; 
     border : 1px solid blue; 
    } 
    -->

  5. #5
    ********* Streaker Lister14's Avatar
    Join Date
    Jun 2002
    Location
    C:\Documents and Settings\Desktop\Recycle Bin
    Posts
    677
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    agree with xhtmlcoder.

    (seen this before somewhere, will post link if i can find it...)
    roy.lu
    C:\DOS... C:\DOS\RUN... RUN\DOS\RUN...!

  6. #6
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Maybe I'll save you the search hassel; try this .

  7. #7
    SitePoint Member
    Join Date
    Oct 2002
    Location
    mtl.
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks alot for the feedback/code/links.

  8. #8
    ********* Streaker Lister14's Avatar
    Join Date
    Jun 2002
    Location
    C:\Documents and Settings\Desktop\Recycle Bin
    Posts
    677
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by xhtmlcoder
    Maybe I'll save you the search hassel; try this .


    well, that's exactly what i was on about...
    roy.lu
    C:\DOS... C:\DOS\RUN... RUN\DOS\RUN...!

  9. #9
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What xhtmlcoder said (the code that he gave), I read in a css coding book!!! Also, if you put the first code posted, with cellpading and cellspacing, the w3c css checker says that they don't exist. And netscape doesn't read that coding correctly.
    Last edited by dragonfly_7456; Jan 15, 2003 at 07:43.
    Content Writing Service - Get custom SEO articles for 10$


Bookmarks

Posting Permissions

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