Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [css]Problem z wyśrodkowaniem
Forum PHP.pl > Forum > Przedszkole
defox
Witam. Mam problem z wyśrodkowaniem strony o kodzie zamieszczonym poniżej.
Główną częścią strony jest "Tabela_01" więc do niej dodałem informacje o marginesach. Dodanie tego do ciała dokumentu również nic nie zmienia. Proszę o pomoc.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Bez nazwy 1</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
  6.  
  7. <style type="text/css">
  8. <!--
  9.  
  10.  
  11.  
  12. #Tabela_01 {
  13. position:absolute;
  14. left:0px;
  15. top:0px;
  16. width:760px;
  17. height:800px;
  18. margin-left: auto;
  19. margin-right: auto;
  20. }
  21.  
  22. #Bez-nazwy-1-01_ {
  23. position:absolute;
  24. left:0px;
  25. top:0px;
  26. width:760px;
  27. height:550px;
  28. }
  29.  
  30. #Bez-nazwy-1-02_ {
  31. position:absolute;
  32. left:0px;
  33. top:550px;
  34. width:760px;
  35. height:250px;
  36. }
  37.  
  38. -->
  39. </style>
  40.  
  41. </head>
  42. <body style="background-color:#FFFFFF;">
  43.  
  44. <div id="Tabela_01">
  45. <div id="Bez-nazwy-1-01_">
  46.  
  47. </div>
  48. <div id="Bez-nazwy-1-02_">
  49.  
  50. </div>
  51. </div>
  52.  
  53. </body>
  54. </html>
mokry
  1. #Tabela_01 {
  2. width:760px;
  3. height:800px;
  4. margin: 0 auto;
  5. }


Nie nadawaj pozycji absolute dla conatinerów wewnętrznych.
defox
To też nie działa.

Edit; czyli mam nie nadawać żadnych atrybutów position?
mokry
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <title>Bez nazwy 1</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
  5.  
  6. <style type="text/css">
  7. <!--
  8.  
  9.  
  10.  
  11. #Tabela_01 {
  12. width:760px;
  13. height:800px;
  14. margin: 0 auto;
  15. }
  16.  
  17. #Bez-nazwy-1-01 {
  18. width:760px;
  19. height:550px;
  20. }
  21.  
  22. #Bez-nazwy-1-02 {
  23. width:760px;
  24. height:250px;
  25. }
  26.  
  27. -->
  28.  
  29. </head>
  30. <body style="background-color:#FFFFFF;">
  31.  
  32. <div id="Tabela_01">
  33. <div id="Bez-nazwy-1-01">
  34.  
  35. </div>
  36. <div id="Bez-nazwy-1-02">
  37.  
  38. </div>
  39. </div>
  40.  
  41. </body>
  42. </html>
specialplan
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <title>Bez nazwy 1</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
  5.  
  6. <style type="text/css">
  7. <!--
  8.  
  9.  
  10.  
  11. #Tabela_01 {
  12. width:760px;
  13. height:800px;
  14. margin-left: auto;
  15. margin-right: auto;
  16. border: 1px solid red;
  17. }
  18.  
  19. #Bez-nazwy-1-01_ {
  20. width:760px;
  21. height:550px;
  22. }
  23.  
  24. #Bez-nazwy-1-02_ {
  25. position:absolute;
  26. left:0px;
  27. top:550px;
  28. width:760px;
  29. height:250px;
  30. }
  31.  
  32. -->
  33.  
  34. </head>
  35. <body style="background-color:#FFFFFF;">
  36.  
  37. <div id="Tabela_01">
  38. <div id="Bez-nazwy-1-01_">
  39. tralalala
  40. </div>
  41. <div id="Bez-nazwy-1-02_">
  42.  
  43. </div>
  44. </div>
  45.  
  46. </body>
  47. </html>


Ten border to tak dla picu, by bylo widac, ze jest na srodku:)

edit: Mokry napisal w tym samym czasie:)
defox
Ok dzieki ;D

edit: jednak u mnie cos nie działa;/ Teraz strona jest w lewym marginesie, gdy usunę "position" wszystko się rozjeżdza tzn, jest ulozone pod sobą, w lewym marginesie. Kod do wglądu.
  1. <title>Bez nazwy 1</title>
  2. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
  3. <!-- ImageReady Styles (Bez nazwy 1.psd) -->
  4. <style type="text/css">
  5. <!--
  6.  
  7.  
  8.  
  9. #Tabela_01 {
  10.  
  11. width:760px;
  12. height:800px;
  13. left: 0px;
  14. top: 0px;
  15. margin: 0 auto;
  16.  
  17.  
  18.  
  19. }
  20.  
  21. #Bez-nazwy-1-01 {
  22. left:0px;
  23. top:0px;
  24. width:760px;
  25. height:171px;
  26. background-image: url(images/Bez-nazwy-1_01.jpg);
  27. position: absolute;
  28. }
  29.  
  30. #Bez-nazwy-1-02 {
  31. position:absolute;
  32. left:0px;
  33. top:171px;
  34. width:760px;
  35. height:8px;
  36. background-image: url(images/Bez-nazwy-1_02.jpg);
  37. }
  38.  
  39. #Bez-nazwy-1-03 {
  40. position:absolute;
  41. left:0px;
  42. top:179px;
  43. width:70px;
  44. height:43px;
  45. background-image: url(images/Bez-nazwy-1_03.jpg);
  46. }
  47.  
  48. #Bez-nazwy-1-04 {
  49. position:absolute;
  50. left:70px;
  51. top:179px;
  52. width:108px;
  53. height:35px;
  54. background-image: url(images/Bez-nazwy-1_04.jpg);
  55.  
  56. }
  57.  
  58. #Bez-nazwy-1-05 {
  59. position:absolute;
  60. left:178px;
  61. top:179px;
  62. width:12px;
  63. height:43px;
  64. background-image: url(images/Bez-nazwy-1_05.jpg);
  65. }
  66.  
  67. #Bez-nazwy-1-06 {
  68. position:absolute;
  69. left:190px;
  70. top:179px;
  71. width:58px;
  72. height:35px;
  73. background-image: url(images/Bez-nazwy-1_06.jpg);
  74.  
  75. }
  76.  
  77. #Bez-nazwy-1-07 {
  78. position:absolute;
  79. left:248px;
  80. top:179px;
  81. width:17px;
  82. height:43px;
  83. background-image: url(images/Bez-nazwy-1_07.jpg);
  84. }
  85.  
  86. #Bez-nazwy-1-08 {
  87. position:absolute;
  88. left:265px;
  89. top:179px;
  90. width:89px;
  91. height:35px;
  92. background-image: url(images/Bez-nazwy-1_08.jpg);
  93. }
  94.  
  95.  
  96.  
  97. -->
  98. <!-- End ImageReady Styles -->
  99. </head>
  100. <body style="background-color:#FFFFFF;">
  101. <div id="Tabela_01">
  102. <div id="Bez-nazwy-1-01"> </div>
  103.  
  104. <div id="Bez-nazwy-1-02"> </div>
  105. <div id="Bez-nazwy-1-03"> </div>
  106. <div id="Bez-nazwy-1-04">
  107. <a href="http://www.onet.pl"><img border="0" style="float:right" src="images\Bez-nazwy-1_04.jpg"></a> </div>
  108. <div id="Bez-nazwy-1-05"> </div>
  109. <div id="Bez-nazwy-1-06">
  110. <a href="o_firmie.html"><img border="0" style="float:right" src="images\Bez-nazwy-1_06.jpg"></a> </div>
  111. <div id="Bez-nazwy-1-07"> </div>
  112. <div id="Bez-nazwy-1-08"> </div>
  113.  
  114. </div>
  115. </body>
  116. </html>


refresh...
-NEEKE-
Kurs CSS sie klania. Czy niemyslales by uzyc czegos takiego jak display? poczytaj a przy okazji polecam float
defox
próbwałem różnych wartości dla display i nic się nie zmienia... może mi ktoś pomóc?

@refresh
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.