Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML,CSS] czy jest możliwy taki układ
krzychu0808
post
Post #1





Grupa: Zarejestrowani
Postów: 428
Pomógł: 2
Dołączył: 1.04.2007
Skąd: Pogorzelica

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


Mam pytanie bo chcę zrobić strone o takim układzie div:


Ale nie wiem czy wogóle jest możliwe ustawienie takiego układu bo strona ma być wyśrodkowana...
Bardzo proszę o pomoc....
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
Cezar708
post
Post #2





Grupa: Zarejestrowani
Postów: 1 116
Pomógł: 119
Dołączył: 10.05.2005
Skąd: Poznań

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


hmm... zawsze możesz użyć do wyśrodkowania prostego JavaScript i CSS, wiem, że na niektórych rzeglądarkach są rozbieżności, ale to powinno zadziałać:

  1. body{
  2. padding: 0px;
  3. margin: 0px;
  4. }
  5. div#tab1{
  6. background-color: red;
  7. width: 700px;
  8. height: 200px;
  9. }
  10.  
  11. div#tab2{
  12. background-color: blue;
  13. width: 700px;
  14. height: 400px;
  15. }
  16. div#tab3{
  17. background-color: yellow;
  18. position: absolute;
  19. left: 400px;
  20. top: 0px;
  21. width: 300px;
  22. height: 400px;
  23. }
  24. myWidth = 700;
  25. function $S(id){
  26. return document.getElementById(id).style;
  27. }
  28. function setupDivs(){
  29. var leftMargin = parseInt((screen.width - myWidth)/2);
  30. $S('tab1').marginLeft = leftMargin;
  31. $S('tab2').marginLeft = leftMargin;
  32. $S('tab3').left = 400+leftMargin;
  33. }
  34. <body align="center" onload="setupDivs()">
  35. <div id="tab1">
  36. Tabelka 1
  37. </div>
  38. <div id="tab2">
  39. Tabelka 2
  40. </div>
  41. <div id="tab3">
  42. Tabelka 3
  43. </div>
  44. </body>
  45. </html>


oczywiście zmienne są zahardkodowane, ale nic nie szkodzi na przeszkodzie aby je zmienić lub troche przerobić kod.

Pozdrawiam
Go to the top of the page
+Quote Post
nevt
post
Post #3





Grupa: Przyjaciele php.pl
Postów: 1 595
Pomógł: 282
Dołączył: 24.09.2007
Skąd: Reda, Pomorskie.

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


a może nieco pościej?
  1. <div class="a">
  2. <div class="b">
  3. <div class="c"></div>
  4. <div class="d"></div>
  5. </div>
  6. </div>

oraz CSS
Kod
* { margin: 0px; padding: 0px; }
.a { width: 600px; margin: 0px auto; }
.b { width: 100%; height: 400px; background: blue; float: left; }
.c { width: 500px; height: 100px; background: red; float: left; }
.d { width: 100px; height: 300px; background: yellow; float: right;}

powodzenia.

Ten post edytował nevt 4.01.2008, 18:50:44


--------------------

-
Oh no, my young coder. You will find that it is you who are mistaken, about a great many things... -
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 Aktualny czas: 21.08.2025 - 23:20