• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

Alternating row colors

The Table below I want the first row yellow then the next no color the 3rd row gray then the 4th white then keep alternating the gray and white or gray and no color?

<table height="209" >
        <tr align="left" valign="middle"> 
          <td colspan="4">Bear Watching Lodge Rates</td>
        </tr>
        <tr align="left" valign="middle"> 
          <td colspan="4">Rates are per person. Bear Viewing Season June 2010 
            thru September 2010</td>
        </tr>
        <tr> 
          <td width="60" align="left" valign="middle">Price</td>
          <td width="142" align="center" valign="middle">$5,400</td>
          <td width="137" align="center" valign="middle">$3,700</td>
          <td width="111" align="center" valign="middle">$2,950</td>
        </tr>
        <tr> 
          <td rowspan="2" align="left" valign="middle">Days</td>
          <td align="center" valign="middle">8 days - 7 nights</td>
          <td align="center" valign="middle">5 days - 4 nights</td>
          <td align="center" valign="middle">4 days - 3 nights</td>
        </tr>
        <tr> 
          <td align="center" valign="middle">Sunday - Sunday</td>
          <td align="center" valign="middle">Sunday - Thursday</td>
          <td align="center" valign="middle">Thursday - Sunday</td>
        </tr>
        <tr align="left" valign="middle"> 
          <td colspan="4">Bear watching lodge trips include 3 meals daily, private 
            river front lodging, guided bear viewing/photography unlimited activities 
            including fishing, daily raft trips, jet boat tours and nature hikes</td>
        </tr>
        <tr align="left" valign="middle">
          <td colspan="4">Wilderness bear watching lodge trips require an additional 
            floatplane charter flight <br />
            from King Salmon of $300 Per Person</td>
        </tr>
      </table>

Open in new window

0
smphil
Asked:
smphil
  • 2
1 Solution
 
Cornelia YoderArtistCommented:
There is no magic way to do this.  Easiest is to make a php loop and put the three color lines in it and then just keep repeating via the loop.
0
 
smphilAuthor Commented:
OK how can I do it line by line whithin the table?
0
 
remorinaCommented:
no color = white
You can assign an inline style background to the <tr> element, not so elegant but would do the job

<table height="209" >
        <tr align="left" valign="middle" style="background-color:yellow"> 
          <td colspan="4">Bear Watching Lodge Rates</td>
        </tr>
        <tr align="left" valign="middle"> 
          <td colspan="4">Rates are per person. Bear Viewing Season June 2010 
            thru September 2010</td>
        </tr>
        <tr style="background-color:gray"> 
          <td width="60" align="left" valign="middle">Price</td>
          <td width="142" align="center" valign="middle">$5,400</td>
          <td width="137" align="center" valign="middle">$3,700</td>
          <td width="111" align="center" valign="middle">$2,950</td>
        </tr>
        <tr> 
          <td rowspan="2" align="left" valign="middle">Days</td>
          <td align="center" valign="middle">8 days - 7 nights</td>
          <td align="center" valign="middle">5 days - 4 nights</td>
          <td align="center" valign="middle">4 days - 3 nights</td>
        </tr>
        <tr > 
          <td align="center" valign="middle">Sunday - Sunday</td>
          <td align="center" valign="middle">Sunday - Thursday</td>
          <td align="center" valign="middle">Thursday - Sunday</td>
        </tr>
        <tr align="left" valign="middle"  style="background-color:gray"> 
          <td colspan="4">Bear watching lodge trips include 3 meals daily, private 
            river front lodging, guided bear viewing/photography unlimited activities 
            including fishing, daily raft trips, jet boat tours and nature hikes</td>
        </tr>
        <tr align="left" valign="middle">
          <td colspan="4">Wilderness bear watching lodge trips require an additional 
            floatplane charter flight <br />
            from King Salmon of $300 Per Person</td>
        </tr>
      </table>

Open in new window

0
 
smphilAuthor Commented:
Thanks
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now