Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [CSS]pozycja absolute na stronie
borpaw
post 18.02.2012, 18:06:54
Post #1





Grupa: Zarejestrowani
Postów: 439
Pomógł: 0
Dołączył: 3.06.2010

Ostrzeżenie: (50%)
XXX--


Mam taki problem, w tym przykładzie jak chce ustawić pozycjonowanie div relative absolute, jest zero reakcji, układają się jeden pod drugim.
Co trzeba zmienić? zeby dały się układać absolute

  1.  
  2. <div class="page">
  3. <div class="text-main"></div>
  4. <div class="apply-main"></div>
  5. <div class="vote-main"></div>
  6. <div class="events-main"></div>
  7. </div>
  8.  


  1.  
  2. .body
  3. {
  4. margin:0;
  5. padding:0;
  6. background-image:url("../images/bg_main.png");
  7. background-repeat:no-repeat;
  8. width:1440px;
  9. height:1200px;
  10. }
  11. .page
  12. {
  13. position:absolute;
  14. width:970px;
  15. height:1050px;
  16. margin-left:235px;
  17. margin-right:235px;
  18. float:left;
  19. }
  20. .text-main
  21. {
  22. margin-top:260px;
  23. width:380px;
  24. height:138px;
  25. background-image:url("../images/text-main.png");
  26. background-repeat:no-repeat;
  27. }
  28. .apply-main
  29. {
  30. margin-top:80px;
  31. width:225px;
  32. height:32px;
  33. background-image:url("../images/apply-main.png");
  34. background-repeat:no-repeat;
  35. }
  36. .vote-main
  37. {
  38. margin-top:10px;
  39. width:225;
  40. height:32px;
  41. background-image:url("../images/vote-main.png");
  42. background-repeat:no-repeat;
  43. }
  44. .events-main
  45. {
  46. position:absolute;
  47. width:214px;
  48. height:248px;
  49. background-image:url("../images/events-main.png");
  50. background-repeat:no-repeat;
  51. }
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
Damonsson
post 18.02.2012, 18:10:29
Post #2





Grupa: Zarejestrowani
Postów: 2 355
Pomógł: 533
Dołączył: 15.01.2010
Skąd: Bydgoszcz

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


Nadać im jakieś atrybuty?

top,left,right,bottom
Go to the top of the page
+Quote Post
borpaw
post 19.02.2012, 07:41:59
Post #3





Grupa: Zarejestrowani
Postów: 439
Pomógł: 0
Dołączył: 3.06.2010

Ostrzeżenie: (50%)
XXX--


Zrobiłem wszystkie elementy div jako position:absolute i wtedy zadziałało, wystarczy ze jeden jest relative i juz przestaje to działać.
Czy jest tu jakaś zasada?
Go to the top of the page
+Quote Post
Twist
post 19.02.2012, 12:40:06
Post #4





Grupa: Zarejestrowani
Postów: 174
Pomógł: 11
Dołączył: 12.10.2008
Skąd: Dublin

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


Element pozycjonowany absolutnie ustawia sie wzgledem rodzica-relative. Jesli nie ustawisz nigdze relative,to zacznie ustawac sie wzgledem body.
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 19:50