Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [xhtml] Problem z div'ami, błędne pozycjonowanie
eunix
post
Post #1





Grupa: Zarejestrowani
Postów: 85
Pomógł: 0
Dołączył: 22.02.2006

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


Witam,

Chce osiągnąć taki efekt:
(IMG:http://img253.imageshack.us/img253/4409/costakiegohc5.png)

Narazie wyskrobałem tyle, ale efekty trochę marne, bo nie znam się za bardzo na divach.
Proszę o pomoc w poprawieniu tego!

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3.  
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" >
  5. <head>
  6. <meta name="author" content="Święty Mikołaj :-)" />
  7. <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
  8. <style type="text/css">
  9. body, html {
  10. margin: 0;
  11. text-align: center;
  12. }
  13.  
  14. #mainContainer {
  15. border-spacing: 5px;
  16. align: center;
  17. width: 80%;
  18. text-align: left;
  19. overflow: auto;
  20. border-left: 1px solid #717171;
  21. border-right: 1px solid #717171;
  22. }
  23.  
  24. #siteLogo {
  25. width: 100%;
  26. height: 70px;
  27. float: left;
  28. background-color: #fbfbfb;
  29. border: 1px solid #dadada;
  30. }
  31.  
  32. #leftColumn {
  33. width: 60%;
  34. height: 500px;
  35. float: left;
  36. background-color: #fbfbfb;
  37. border: 1px solid #dadada;
  38. }
  39.  
  40. #rightColumn {
  41. width: 40%;
  42. float: right;
  43. overflow: auto;
  44. }
  45.  
  46. #rightColumnMenu1 {
  47. width: 20%;
  48. float: right;
  49. background-color: #fbfbfb;
  50. border: 1px solid #dadada;
  51. }
  52.  
  53. #rightColumnMenu2 {
  54. width: 20%;
  55. float: right;
  56. background-color: #fbfbfb;
  57. border: 1px solid #dadada;
  58. }
  59.  
  60. #rightColumnMenu3 {
  61. width: 40%;
  62. float: right;
  63. background-color: #fbfbfb;
  64. border: 1px solid #dadada;
  65. }
  66.  
  67. #siteFooter {
  68. width: 100%;
  69. height: 60px;
  70. float: left;
  71. }
  72.  
  73. </head>
  74.  
  75. <div id="mainContainer">
  76. <div id="siteLogo">Logo</div>
  77. <div id="leftColumn">teststest</div>
  78. <div id="rightColumn">
  79. <div id="rightColumnMenu1">Menu 1</div>
  80. <div id="rightColumnMenu2">Menu 2</div>
  81. <div id="rightColumnMenu3">Menu 3</div>
  82. </div>
  83. <div id="siteFooter">stopka</div>
  84. </div>
  85.  
  86. </body>
  87. </html>


Ten post edytował eunix 26.12.2006, 14:29:18
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
batman
post
Post #2





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Podany przez Ciebie przykład jest dowodem na to, że stosowanie div-ów na siłę (bo tak) mija się z celem. Zmień układ na tabelę i nie będziesz miał problemu. Ale jeśli się upierasz na div-y, oto rozwiązanie (pokombinuj z szerokościami i wysokościami, wedle własnego uznania):

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <head>
  3. <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  4.  
  5. #main {
  6. width: 500px;
  7. }
  8.  
  9. #head {
  10. background-color: #DBDBDB;
  11. }
  12.  
  13. #center {
  14. }
  15.  
  16. #center_left {
  17. float: left;
  18. width: 70%;
  19. background-color: #BDBDBD;
  20. }
  21.  
  22. #center_right {
  23. float: right;
  24. width: 30%;
  25. }
  26.  
  27. #center_right_left {
  28. float: left;
  29. width: 50%;
  30. background-color: #707070;
  31. }
  32.  
  33. #center_right_right {
  34. float: right;
  35. width: 50%;
  36. background-color: #F3F3F3;
  37. }
  38.  
  39. #center_right_bottom {
  40. background-color: #F0F0F0;
  41. }
  42.  
  43. #foot {
  44. background-color: #DBDBDB;
  45. }
  46.  
  47. .cleaner {
  48. clear: both;
  49. border: 0px none;
  50. }
  51.  
  52.  
  53.  
  54. </style>
  55. </head>
  56. <body>
  57.  
  58. <div id="main">
  59.  
  60. <div id="head">head</div>
  61. <div id="center">
  62. <div id="center_left">left</div>
  63. <div id="center_right">
  64. <div id="center_right_left">right left</div>
  65. <div id="center_right_right">right right</div>
  66. <div class="cleaner"></div>
  67. <div id="center_right_bottom">right foot</div>
  68. </div>
  69. <div class="cleaner"></div>
  70. </div>
  71. <div id="foot">foot</div>
  72.  
  73. </div>
  74.  
  75. </body>
  76. </html>
Go to the top of the page
+Quote Post

Posty w temacie


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: 15.10.2025 - 14:37