Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>Document</title>
  9. <style>
  10. h1 {
  11. color: red;
  12. }
  13.  
  14. .odd {
  15. background-color: beige;
  16. width: 75px;
  17. height: 75px;
  18. }
  19.  
  20. .even {
  21. background-color: brown;
  22. width: 75px;
  23. height: 75px;
  24. }
  25. </style>
  26. </head>
  27.  
  28. <body>
  29. <?php
  30.  
  31. $x_vak = 8;
  32. echo "<h1>hello</h1><br>";
  33. echo "<table>";
  34. $x = 1;
  35. $y = 1;
  36. for ($x > 0; $x < $x_vak; $x++) {
  37.  
  38. if ($x & 1) {
  39. echo "<tr>";
  40. while ($y < $x_vak) {
  41. $y++;
  42. if ($y & 1) {
  43. echo "<td class ='even'></td>";
  44. } else {
  45. echo "<td class ='odd'></td>";
  46. }
  47. }
  48. $y = 1;
  49. echo "</tr>";
  50. } else {
  51. echo "<tr>";
  52. while ($y < $x_vak) {
  53. $y++;
  54. if ($y & 1) {
  55. echo "<td class = 'odd'></td>";
  56. } else {
  57. echo "<td class = 'even'></td>";
  58. }
  59. }
  60. $y = 1;
  61. echo "</tr>";
  62. }
  63. }
  64.  
  65. echo "</table>";
  66.  
  67.  
  68. ?>
  69.  
  70. </body>
  71.  
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement