SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Corner seat
    Posts
    1,069
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XHTML - Table - Border - Width - 1px

    So ... I am trying to make my site 100% XHTML compliant; it's not easy. The following is one of problems I have and I am hoping that someone here can help me to resolve the problem.

    Code:
    table.myTable
    {
        border-spacing: 1px;
        border-width: 0px;
        padding: 0px;
        height: 21px;
        width: 730px;
        background-color: #c0c0c0;
    }
    What I'm trying to do is to create a table that has a border whose width is exactly 1px. The code presented seems to work in Netscape7.1 and Opera7.0 but not in IE, which is the most important browser. In IE, the border width becomes 2px for some reason. What's wrong with the code presented? How can I create a table whose border's width is exactly 1px?

  2. #2
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Corner seat
    Posts
    1,069
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind; I found a solution.

    http://www.sitepointforums.com/showthread.php?t=117994

    The first rely is the answer for me. I do have a question though.

    q. Are cellspacing and cellpadding XHTML compliant attributes of table?

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2003
    Location
    Birmingham UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As these elements are presentational, I'd assume that they are/will be depreciated. It's best to use the margin and padding elements in CSS instead.
    Rich.
    Late Night, Cold Coffee: Like daytime, but darker.

  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)
    It depends upon which version of XHTML you plan to use though it is still available for XHTML 1.1.

  5. #5
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Corner seat
    Posts
    1,069
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's best to use the margin and padding elements in CSS instead.
    If I were to use margin and padding, how would I do that? How would I do cellspacing="0" cellpadding="0"?

  6. #6
    SitePoint Zealot
    Join Date
    Sep 2003
    Location
    Birmingham UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well in your code (copied from above), you alredy have padding set to 0, so just add:

    table.myTable
    {
    border-spacing: 1px;
    border-width: 0px;
    padding: 0px;
    margin: 0;
    height: 21px;
    width: 730px;
    background-color: #c0c0c0;
    }

    you can also add margins and padding to individual cells by assigning a class to a particular td, e.g. <td class="myclass">.
    Rich.
    Late Night, Cold Coffee: Like daytime, but darker.


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
  •