Needing to add color to the top most row and left most coloum is there something i am

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CerberusAngl
    New Member
    • Oct 2016
    • 3

    Needing to add color to the top most row and left most coloum is there something i am

    Code:
    <?php
    $cols = 10;
    $rows = 10;
    
    
    
    for ($r =1; $r < $rows; $r++){
    
        echo('<tr>');
    
        for ($c = 1; $c < $cols; $c++)
            echo( '<td>' .$c*$r.'</td>');
    
        echo('</tr>');
    
    }
    
    echo("</table>");
    
    	
    ?>
    Last edited by Dormilich; Oct 4 '16, 06:12 AM. Reason: please use code tags
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    for adding colour you use CSS. esp. look into the :first-child pseudo-class here.

    Comment

    • CerberusAngl
      New Member
      • Oct 2016
      • 3

      #3
      I see where that could add color to the top most row using css but how could I on the left most row of the same table?

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        the left-most row of a table is usually made of the first TD in each row ...

        Comment

        • CerberusAngl
          New Member
          • Oct 2016
          • 3

          #5
          I cannot thank you enough for this, I'd hug you if I could!

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            glad I could be of help.

            Comment

            Working...