Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [CSS]Automatycznie rozciągający się div
Forum PHP.pl > Forum > Przedszkole
kristos44
Potrzebuję zrobić trzy kolumnowy układ strony plus nagłówek i stopka. Kod html wygląda tak:
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  4. <link rel="stylesheet" href="style.css" type="text/css"/>
  5. </head>
  6. <body>
  7. <div id="wrapper">
  8. <div id="top">
  9. top
  10. </div>
  11. <div id="menu">
  12. menu
  13. </div>
  14. <div id="content">
  15. <div id="left">
  16. left
  17. </div>
  18. <div id="center">
  19. center</br>
  20. center</br>
  21. center</br>
  22. center</br>
  23. center</br>
  24. center</br>
  25. center</br>
  26. center</br>
  27. center</br>
  28. center</br>
  29. </div>
  30. <div id="right">
  31. right</br>
  32. right</br>
  33. right</br>
  34. right</br>
  35. right</br>
  36. </div>
  37. </div>
  38. <div id="clear"></div>
  39. <div id="footer">
  40. footer
  41. </div>
  42. </div>
  43. </body>
  44. </html>

Do tego plik css:
  1. html, body, div {
  2. margin: 0;
  3. padding: 0;
  4. }
  5.  
  6. #wrapper {
  7. margin: 0 auto;
  8. width: 1000px
  9. }
  10.  
  11. #top {
  12. background: blue;
  13. height: 150px
  14. }
  15.  
  16. #menu {
  17. background: yellow
  18. }
  19.  
  20. #content {
  21. background: red;
  22. width: 1000px;
  23. }
  24.  
  25. #left {
  26. width: 200px;
  27. float: left
  28. }
  29.  
  30. #center {
  31. width: 600px;
  32. float: left
  33. }
  34.  
  35. #right {
  36. width: 200px;
  37. float: left
  38. }
  39.  
  40. #clear {
  41. clear: both;
  42. }
  43.  
  44. #footer {
  45. background: orange;
  46. width: 1000px
  47. }


Chciałbym aby div content rozszerzał się w dół w zależności od wysokości divów w nim zawartych. W zasadzie w zależności od wysokości diva center, gdyż jest to div z treścią i z reguły będzie najdłuższy.
skowron-line
Najprościej będzie to chyba zrobić w JS.
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.