Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]generowanie divów koło siebie
ghastblood
post
Post #1





Grupa: Zarejestrowani
Postów: 360
Pomógł: 12
Dołączył: 17.09.2009
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


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
Go to the top of the page
+Quote Post
toaspzoo
post
Post #2





Grupa: Zarejestrowani
Postów: 778
Pomógł: 84
Dołączył: 29.07.2010
Skąd: Gliwice / Pławniowice Mistrz niezmordowanej klawiatury.

Ostrzeżenie: (20%)
X----


<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
Go to the top of the page
+Quote Post
askone
post
Post #3





Grupa: Zarejestrowani
Postów: 654
Pomógł: 121
Dołączył: 27.10.2007
Skąd: Poznań, Łódź

Ostrzeżenie: (0%)
-----


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...
Go to the top of the page
+Quote Post
ghastblood
post
Post #4





Grupa: Zarejestrowani
Postów: 360
Pomógł: 12
Dołączył: 17.09.2009
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


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
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 23:07