Advertisement
Guest User

šachovnice

a guest
Nov 19th, 2015
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <style>
  2. #herni_pole {
  3.     margin-right: auto;
  4.     margin-left: auto;
  5.     width: 480px;
  6.     height: 480px;
  7.     border: 5px solid #000;
  8. }
  9.  
  10. .bilej, .cernej {
  11.     float: left;
  12.     width: 60px;
  13.     height: 60px;
  14. }
  15.  
  16. .bilej {background-color: #fff;}
  17. .cernej {background-color: #000;}
  18. </style>
  19.  
  20. <div id="herni_pole">
  21.     <?php
  22.     $vyska = 8;
  23.     $sirka = 8;
  24.  
  25.     for($y=$vyska; $y>0; $y--) {
  26.         for($x=0; $x<$sirka; $x++) {
  27.             echo (($x+$y)%2==0) ? "<div class='bilej'></div>" : "<div class='cernej'></div>";
  28.         }
  29.     }
  30.     ?>
  31. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement