SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php style and class problems

    I'm having difficulty with styles in coloring every other row in a table.

    If I use an in-line style such as:

    Code:
    echo "<tr valign='top' bgcolor='yellow'>\n";
    It works just fine.

    However, when I use an embedded style such as:
    Code:
    <style type="text/css">
      .oddRow {
    	bgcolor: red;
    	
      }
    </style>
    with the following code:
    Code:
    echo "<tr valign='top' class='oddRow'>\n";
    It does not work. The row bgcolor does not change to red.

    TIA,

    skibikegolf
    Last edited by skibikegolf; Apr 15, 2007 at 08:43.

  2. #2
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's because your style-rule is not valid.
    Use:
    Code:
      .oddRow {
    	background-color: red;
    	
      }

  3. #3
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Problem solved.

    Thank you and thank you for the link.

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Location
    DK
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And you shouldn't use valign='top' in the tr-tag

    Ad this to your stylesheed:

    Code:
    tr {vertical-align: top;}
    and all table rows will have text aligned to the top of the cells.

    Drawback: IE5 and earlier won't understand it!

    You could take a look at the CSS section of this forum...

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Location
    DK
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And you shouldn't use valign='top' in the tr-tag

    Ad this to your stylesheed:

    Code:
    tr {vertical-align: top;}
    and all table rows will have text aligned to the top of the cells.

    Drawback: IE5 and earlier doesn't support this and will ignore it!

    You could take a look at the CSS section of this forum...


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
  •