Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [HTML]Centrowanie kilku div-ów.
Morfi80
post
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 1.11.2012

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


Czy mógłby mi ktoś wyjaśnić gdzie robie błąd?
Chcę uzyskać taki efekt jak w tym screenie: http://screenshooter.net/7767881/syljgsl ale bez używania marginesów bocznych.

Tutaj jest kod html strony:
http://screenshooter.net/7767881/uhbmmlh

a tutaj css:
http://screenshooter.net/7767881/yikgopc

Pomóżcie (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
b4rt3kk
post
Post #2





Grupa: Zarejestrowani
Postów: 1 933
Pomógł: 460
Dołączył: 2.04.2010
Skąd: Lublin

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


Jeśli masz ustawione float: left, to siłą rzeczy boxy "kleją się" do lewej krawędzi. Nie muszą to być divy, wystarczą same linki z tłem.

  1. <style type="text/css">
  2. .boxContainer {
  3. margin: auto;
  4. width: 660px;
  5. }
  6.  
  7. .boxContainer2 {
  8. margin: auto;
  9. width: 460px;
  10. }
  11.  
  12. .box {
  13. display: block;
  14. float: left;
  15. width: 200px;
  16. height: 200px;
  17. background: red;
  18. margin: 10px;
  19. }
  20.  
  21. .clear {
  22. clear: both;
  23. }
  24.  
  25. <div class="boxContainer">
  26. <a class="box" href=""></a>
  27. <a class="box" href=""></a>
  28. <a class="box" href=""></a>
  29. <div class="clear"></div>
  30. <div class="boxContainer2">
  31. <a class="box" href=""></a>
  32. <a class="box" href=""></a>
  33. <div class="clear"></div>
  34. </div>
  35. </div>
Go to the top of the page
+Quote Post
Morfi80
post
Post #3





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 1.11.2012

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


Dziękuję, działa (IMG:style_emoticons/default/smile.gif)
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: 25.12.2025 - 19:40