Advertisement
braveheart1989

17. RGB Table

Jun 29th, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>First Steps Into PHP</title>
  6.     <style>
  7.         table * {
  8.             border: 1px solid black;
  9.             width: 50px;
  10.             height: 50px;
  11.         }
  12.     </style>
  13. </head>
  14. <body>
  15. <table>
  16.     <tr>
  17.         <td>
  18.             Red
  19.         </td>
  20.         <td>
  21.             Green
  22.         </td>
  23.         <td>
  24.             Blue
  25.         </td>
  26.     </tr>
  27.     <?php
  28.     for ($i = 51; $i <= 255; $i+=51) {
  29.        echo "<tr>\n";
  30.         $colorRed = "rgb($i, 0, 0)";
  31.         $colorGreen = "rgb(0, $i, 0)";
  32.         $colorBlue= "rgb(0, 0, $i)";
  33.         echo "\t<td style = 'background-color:$colorRed'>";
  34.         echo "\t<td style = 'background-color:$colorGreen'>";
  35.         echo "\t<td style = 'background-color:$colorBlue'>";
  36.         echo "</tr>\n";
  37.     }
  38.     ?>
  39. </table>
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement