Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: div i jego wysokosc
Forum PHP.pl > Forum > Po stronie przeglądarki > HTML \ XHTML
barF
mam problem z wysokoscia kontenera.
niemoge spasowac zeby dzialalo pod FF i jednoczesnie dla IE

index.html
  1. <body>
  2. <div id="page">
  3. <div id="top"></div>
  4. <div id="content">
  5. <div>
  6. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  7. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  8. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  9. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  10. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  11. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  12. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  13. </div>
  14. </div>
  15. <div id="menu">menu</div>
  16. <div id="footer"></div>
  17. </div>
  18. </body>


i style CSS
  1. html, body {
  2. margin: 15px;
  3. }
  4. body {
  5. background: #a9ac99;
  6. font-size: 13px;
  7. font-family: 'Trebuchet MS', 'Bitstream Vera Sans', Verdana, Arial, 'Lucida Sans', 'Lucida Sans Unicode', Helvetica, sans-serif;
  8. }
  9. #page {
  10. width: 714px;
  11. background: #ffffff url(images/middle.png);
  12. border: 0px solid #000000;
  13. margin: 10px auto;
  14. #height: auto;
  15. }
  16. #top {
  17. height: 15px;
  18. background: url(images/top.png) no-repeat;
  19. }
  20. #content {
  21. width: 400px;
  22. float: left;
  23. padding: 10px 20px 30px;
  24. }
  25. #menu {
  26. width: 230px;
  27. float: left;
  28. }
  29. #footer {
  30. height: 70px;
  31. background: url(images/bottom.png);
  32. #clear: both;
  33. }

jak odkomentuje clear:both; to pod FF dziala dobrze.
niewiem gdzie robie blad dry.gif
Zajec
Nigdze. Clear jest potrzebny, jeśli chcesz, aby rodzic rozciągnął swoją wysokość.

Zgodnie ze standardami elementy z przypisanym float nie mają wpływu na wysokość rodzica.
mike
Rozciągniesz rodzica dając mu (dla rodzica) overflow: auto; i będziesz mógł wywalić clear: both;
barF
mike_mech:
zrobilem tak jak mowiles, ale efekt niejest zadowalajacy.

po zmianie mam
  1. #page {
  2. width: 714px;
  3. background: #ffffff url(images/middle.png);
  4. border: 0px solid #000000;
  5. margin: 10px auto;
  6. overflow: auto;
  7. }
  8. #footer {
  9. height: 70px;
  10. width: 714px;
  11. background: url(images/bottom.png);
  12. }


1) w IE wyglad ramki OK ale niejest wycentrowana :/ , problem zalatwia dodanie do CSS body text-align: center;
ale czy niemozna tego okreslic w #page (how)?

2) w FF wszystko ramka jest wycentrowana.
ale niejest wyswietlana poprawnie. zobaczcie jak to wyglada TUTAJ
mike
Spróbuj tak:
  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.  
  7. <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
  8.  
  9. <style type="text/css">
  10. html, body {
  11. margin: 15px;
  12. }
  13. body {
  14. background: #a9ac99;
  15. font-family: normal 13px Trebuchet MS, Bitstream Vera Sans, Verdana, Arial, Lucida Sans, Lucida Sans Unicode, Helvetica, sans-serif;
  16. text-align: center;
  17. }
  18.  
  19. #page {
  20. width: 714px;
  21. background: #ffffff url( 'images/middle.png' );
  22. margin: 10px auto;
  23. overflow: auto;
  24. text-align: left;
  25. }
  26.  
  27. #top {
  28. width: 714px;
  29. height: 15px;
  30. background: url( 'images/top.png' ) no-repeat;
  31. float: left;
  32. }
  33.  
  34. #content {
  35. width: 400px;
  36. float: left;
  37. padding: 10px 20px 30px 20px;
  38. }
  39.  
  40. #menu {
  41. width: 274px;
  42. float: right;
  43. }
  44.  
  45. #footer {
  46. height: 70px;
  47. width: 714px;
  48. background: url(images/bottom.png);
  49. float: left;
  50. }
  51. </style>
  52.  
  53. </head>
  54.  
  55. <body scroll="no">
  56.  
  57. <div id="page">
  58. <div id="top"></div>
  59. <div id="content">
  60. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  61. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  62. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  63. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  64. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  65. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  66. ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel ble bel bel
  67. </div>
  68. <div id="menu">menu</div>
  69. <div id="footer"></div>
  70. </div>
  71.  
  72. </body>
  73. </html>


badzIEwIE może inaczej szerokości bloków wyświetlać, ale to dlatego że inaczej interpretuje padding. Łetwo to zmienisz dodając alternatywne style dla niego.
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.