GeekInterview.com
Results 1 to 2 of 2

Give background color to table row..

This is a discussion on Give background color to table row.. within the Web Development forums, part of the category; I have created table in HTML & it is dynamic table but I want to give background color to their rows but the color combination is like this... If row ...

  1. #1
    ManojGahlot is offline Junior Member Array
    Join Date
    Feb 2010
    Answers
    9

    Question Give background color to table row..

    I have created table in HTML & it is dynamic table but I want to give background color to their rows but the color combination is like this...
    If row no is even then background color is red.
    if row no is odd then background color is yellow.
    Please tell me How can i do it ?


  2. #2
    Sandhya.Kishan is offline Expert Member Array
    Join Date
    Mar 2012
    Answers
    212

    Re: Give background color to table row..

    The code can be



    for($i = 0; $i < 10; $i++) {
    if ($i%2) {
    $color = "red";
    } else {
    $color = "yellow";
    }
    ?>






    }

    Cell 1 Cell 2 Cell 3