Changing HTML to XHTML, problem with CSS table

Discussion in 'CSS' started by Melontree, May 16, 2009.

  1. #1
    I'm busy editing my site from HTML to XHTML but I've run into a problem.

    I was using CSS in the head section, with class selectors to make my table rows alternate colours:

    td,pre,p{font-size: 13px; font-family: verdana;}
    td{line-height: 20px;}
    .tp{color:#0000FF; font-weight: bold;}
    .rb{background:#FFFFFF}
    .ry{background:#F0F0F0}

    It looked fine until I changed the DOCTYPE to XHTML - then for some reason only one table on my page (the one with the alternate colours) seemed to become double spaced.

    Anyone have any ideas why this might have happened?

    You can see the source at mrquicker.com
     
    Melontree, May 16, 2009 IP
  2. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't see a DOCTYPE at all on your page?
     
    wd_2k6, May 16, 2009 IP
  3. Melontree

    Melontree Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I took the DOCTYPE out because it was causing these problems with the layout of my page. The layout as it appears now is how I want it to be, but when I put the XHTML DOCTYPE in (which I copied from w3schools) it doubles the line spacing in the second table.... Any ideas?
     
    Melontree, May 17, 2009 IP
  4. pipes

    pipes Prominent Member

    Messages:
    12,766
    Likes Received:
    958
    Best Answers:
    0
    Trophy Points:
    360
    #4
    You need a Doctype for XHTML from what im aware, its necessary.
     
    pipes, May 20, 2009 IP
  5. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #5
    All web pages are required to have a doctype.
     
    drhowarddrfine, May 20, 2009 IP
  6. Melontree

    Melontree Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I understand that. The problem, though, is that when I put the XHTML DOCTYPE declaration in there, the formatting on one of the tables on my page changes.....! I don't understand why this is happening...
     
    Melontree, May 22, 2009 IP
  7. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #7
    well if you had left the doctype in when you posted so we could see i could help but you took it out so i cant be bothered to pretend its there
     
    wd_2k6, May 23, 2009 IP
  8. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #8
    You didn't have a doctype at all so you were in quirks mode. When you entered the xhtml doctype, you went into standards mode and that's why everything moved around.
     
    drhowarddrfine, May 24, 2009 IP