Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: CSS - Wysrodkowanie strony+ automatyczne powiekszanie
Forum PHP.pl > Forum > Po stronie przeglądarki
pajdakks
Witam mam problem, ponieważ nie wiem jak wyśrodkować stronę i jak zrobić żeby środek mi się sam rozszerzał, dokładnie chodzi o ten blok #glowna-03.
Mam nadzieję, że mi ktoś pomoże ;p. Pozdrawiam winksmiley.jpg





  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>glowna</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
  6. <style type="text/css">
  7. <!--
  8.  
  9. #Table_01 {
  10.  
  11. text-align: center;
  12. text-align: center;
  13. position:absolute;
  14. left:0px;
  15. top:0px;
  16. width:400px;
  17. height:768px;
  18. }
  19.  
  20. #glowna-01_ {
  21. background-image: url("images/glowna_01.gif");
  22. position:absolute;
  23. left:0px;
  24. top:0px;
  25. width:400px;
  26. height:31px;
  27. }
  28.  
  29. #glowna-02_ {
  30. background-image: url("images/glowna_02.gif");
  31. position:absolute;
  32. left:0px;
  33. top:31px;
  34. width:20px;
  35. height:696px;
  36. }
  37.  
  38. #glowna-03_ {
  39. background-color:#2CA3DA;
  40. background-repeat: repeat-x;
  41. position:absolute;
  42. left:20px;
  43. top:31px;
  44. width:361px;
  45. height:696px;
  46. }
  47.  
  48. #glowna-04_ {
  49. background-image: url("images/glowna_04.jpg");
  50. position:absolute;
  51. left:381px;
  52. top:31px;
  53. width:19px;
  54. height:696px;
  55. }
  56.  
  57. #glowna-05_ {
  58. background-image: url("images/glowna_05.gif");
  59. position:absolute;
  60. left:0px;
  61. top:727px;
  62. width:400px;
  63. height:41;
  64. }
  65.  
  66. -->
  67. </style>
  68. </head>
  69. <div id="Table_01">
  70. <div id="glowna-01_">
  71. </div>
  72. <div id="glowna-02_">
  73. </div>
  74. <div id="glowna-03_">
  75.  
  76. </div>
  77. <div id="glowna-04_">
  78. </div>
  79. <div id="glowna-05_">
  80. </body>
  81. </html>
Volume
Po co CI tam position? Zrob to po przez float i bedzie Ci latwiej. Position nie wysrodkujesz - nadales mu wszystkie wymiary i wypozycjonowales, a do Twojego celu zupelnie nie tedy droga....

Poza tym jesli chcesz zeby strona Ci sie dopasowywala do wielkosci okna to jdnostki w %.
pajdakks
Czyli muszę usnąć :
  1. position:absolute;
?
I co dalej ? ;p
Volume
Przeanalizuj sobie to:
  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>glowna</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
  5. <style type="text/css">
  6. <!--
  7. * {
  8. margin:0;
  9. padding:0;
  10. }
  11. body {
  12. text-align: center;
  13. }
  14. #all {
  15. width: 800px;
  16. text-align: left;
  17. margin: 0 auto;
  18. }
  19.  
  20. #top {
  21. background: red;
  22. height: 50px;
  23. }
  24.  
  25. #left {
  26. background: yellow;
  27. width: 100px;
  28. float: left;
  29. }
  30.  
  31. #cent {
  32. background-color:#2CA3DA;
  33. width: 600px;
  34. float: left;
  35. }
  36.  
  37. #right {
  38. background: green;
  39. width: 100px;
  40. float: left;
  41. }
  42.  
  43. #stopka {
  44. background: orange;
  45. clear: both;
  46. }
  47.  
  48. -->
  49. </head>
  50. <div id="all">
  51. <div id="top">top</div>
  52. <div id="left">left</div>
  53. <div id="cent">
  54. cent cent cent cent cent cent cent cent cent cent cent cent cent cent
  55. cent cent cent cent cent cent cent cent cent cent cent cent cent cent
  56. cent cent cent cent cent cent cent cent cent cent cent cent cent cent
  57. cent cent cent cent cent cent cent cent cent cent cent cent cent cent
  58. </div>
  59. <div id="right">right</div>
  60. <div id="stopka">stopka</div>
  61. </div>
  62.  
  63. </body>
  64. </html>

Osiagniecie tabelowego modelu (display:table-cell) w css jest mozliwe ale nie wszystkie przegladarki sobie z tym radza wiec najlepiej kombinowac dodatkowo po przez obrazki w tle.
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.