Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]generowanie divów koło siebie
Forum PHP.pl > Forum > Przedszkole
ghastblood
Witam,
jak stworzyć pętla która wyświetli mi np 4 divy(265px,190px) po 2 w jednej osi za pomocą left/top

1,2
3,4
toaspzoo
<div style="display: inline">
będą koło siebie, a tak, to daj petle z warunkiem, jesli powtorzenie jest 2 to br
for i =4
askone
Cytat
left/top


Czyżbyś chciał te divy pozycjonować jako absolute lub relative?? Wydaje mi się, iż jeśli umieścisz je w kontenerze o określonych wymiarach - 435px, 400px - i nadasz divom float:left to one się zawiną po wypełnieniu kontenera...
ghastblood
konkretnie chodzi mi o generowanie mapy do gry.

ma główny kontener o wymiarach 300x300 position:fixed; overflow:hidden;
w kontenerze mam divy o wymiarach 265x190 position:absolute;
który wyświetla mi kafelki 53x38 czyli pole 5 na 5

  1. <div id="map_container">
  2. <div style="position: absolute; width: 265px; height: 190px;">
  3. <div class="map_border" style="z-index: 3; position: absolute; width: 1px; height: 190px; left: 0px; top: 0px;"></div>
  4. <div class="map_border" style="z-index: 3; position: absolute; width: 265px; height: 1px; left: 0px; top: 0px;"></div>
  5. <img style="position: absolute; z-index: 2; left: 0px; top: 0px;" src="img/gras4.png">
  6. <img style="position: absolute; z-index: 2; left: 0px; top: 38px;" src="img/gras4.png">
  7. <img style="position: absolute; z-index: 2; left: 0px; top: 76px;" src="img/gras4.png">
  8. <img style="position: absolute; z-index: 2; left: 0px; top: 114px;" src="img/gras4.png">
  9. <img style="position: absolute; z-index: 2; left: 0px; top: 152px;" src="img/gras4.png">
  10. <img style="position: absolute; z-index: 2; left: 53px; top: 0px;" src="img/gras4.png">
  11. <img style="position: absolute; z-index: 2; left: 53px; top: 38px;" src="img/gras4.png">
  12. <img style="position: absolute; z-index: 2; left: 53px; top: 76px;" src="img/gras4.png">
  13. <img style="position: absolute; z-index: 2; left: 53px; top: 114px;" src="img/gras4.png">
  14. <img style="position: absolute; z-index: 2; left: 53px; top: 152px;" src="img/gras4.png">
  15. <img style="position: absolute; z-index: 2; left: 106px; top: 0px;" src="img/gras4.png">
  16. <img style="position: absolute; z-index: 2; left: 106px; top: 38px;" src="img/gras4.png">
  17. <img style="position: absolute; z-index: 2; left: 106px; top: 76px;" src="img/gras4.png">
  18. <img style="position: absolute; z-index: 2; left: 106px; top: 114px;" src="img/gras4.png">
  19. <img style="position: absolute; z-index: 2; left: 106px; top: 152px;" src="img/gras4.png">
  20. <img style="position: absolute; z-index: 2; left: 159px; top: 0px;" src="img/gras4.png">
  21. <img style="position: absolute; z-index: 2; left: 159px; top: 38px;" src="img/v4.png">
  22. <img style="position: absolute; z-index: 2; left: 159px; top: 76px;" src="img/gras4.png">
  23. <img style="position: absolute; z-index: 2; left: 159px; top: 114px;" src="img/gras4.png">
  24. <img style="position: absolute; z-index: 2; left: 159px; top: 152px;" src="img/gras4.png">
  25. <img style="position: absolute; z-index: 2; left: 212px; top: 0px;" src="img/gras4.png">
  26. <img style="position: absolute; z-index: 2; left: 212px; top: 38px;" src="img/gras4.png">
  27. <img style="position: absolute; z-index: 2; left: 212px; top: 76px;" src="img/gras4.png">
  28. <img style="position: absolute; z-index: 2; left: 212px; top: 114px;" src="img/gras4.png">
  29. <img style="position: absolute; z-index: 2; left: 212px; top: 152px;" src="img/gras4.png">
  30. </div>
  31. </div>


żeby stworzyć map 999 kafli na 999 kafli muszę wygenerować mapę składającą się z x = 4995 divów y = 4995 divów
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.