Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: automatycznie dopasowana wysokosc diva
Forum PHP.pl > Forum > Po stronie przeglądarki > CSS
elem323
Witam, tak jak w temacie.. nie wiem czy znajdzie sie odwazny zeby sie z tym zmiezyc, bo problem raczej ciezki. Ponizej kod. dziala w IE6, FF3, nie dizla w IE7, IE8, Safari4


  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  3. "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
  5.  
  6. </head>
  7.  
  8. <div style="background:#99FF00; width:400px; overflow:hidden; height:100%; display:table">
  9.  
  10. <div style="float:left; width:200px; display:table; height:100%; background:#eaeaea;">
  11. This design uses a defined body height of 100% which allows setting the contained left and right divs at 100% height.
  12. </div>
  13. <div style="float:left; width:200px; display:table; overflow:hidden; background:#990000">
  14. contained left and right divs at 100% height. This design uses a defined body height of 100% which allows setting the
  15. contained left and right divs at 100% height. This design uses a defined body height of 100% which allows setting the
  16. contained left and right divs at 100% height. This design uses a defined body height of 100% which allows setting the
  17. contained left and right divs at 100% height. This design uses a defined body height of 100% which allows setting the
  18. </div>
  19.  
  20. </div>
  21.  
  22. </body>
  23. </html>
drake88
Zamień height: 100% na height: auto
elem323
niestety az tak proste to nie jest ..jak dam height:auto, to juz niegdzie nie dziala
Daiquiri
dodaj position:fixed; w zielonym divie smile.gif
elem323
chlopaki, nie robmy zgadywanki, no baredzo was prosze. Najpierw sprawdzic potem odpowiedziec.
Ale dzieki kazdemu ktos sprobuje.
Daiquiri
Poprawiłam tak, żeby działało tak samo pod IE6 jak i FF3 (u mnie różnica polega na tym, że pod IE zielony div rozciąga się do końca strony, zaś w FF jest niewidoczny). Więc uwierz mi, że nie strzelam, tylko sprawdzałam. Wklej chociaż prowizorycznie co chcesz osiągnąć np. za pomocą *jpg.
elem323
dokladnie to co jest na FF3, tzn, w czerwonego Dive wpisuje tyle tekstu ile tylko chce, a div szary zawsze doasuje swoja wysokosc do wysokosci diva czerwonego
Daiquiri
POD IE8 działa (nie wiem jak Safari i IE7) - nie mam możliwości sprawdzenia.

  1. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
  2. <style media="screen" type="text/css">
  3. /* <!-- */
  4. body {
  5. margin:0;
  6. padding:0;
  7. }
  8.  
  9.  
  10. #container2 {
  11. clear:left;
  12. float:left;
  13. width:100%;
  14. overflow:hidden;
  15. background:#990000;
  16. }
  17. #container1 {
  18. float:left;
  19. width:100%;
  20. position:relative;
  21. right:50%;
  22. background:#eaeaea;
  23. }
  24. #col1 {
  25. float:left;
  26. width:46%;
  27. position:relative;
  28. left:52%;
  29. overflow:hidden;
  30. }
  31. #col2 {
  32. float:left;
  33. width:46%;
  34. position:relative;
  35. left:56%;
  36. overflow:hidden;
  37. }
  38.  
  39. </style>
  40. </head>
  41.  
  42. <body>
  43.  
  44. <div id="container2">
  45. <div id="container1">
  46. <div id="col1">
  47.  
  48. This design uses a defined body height of 100% which allows setting the contained left and right divs at 100% height.
  49.  
  50. </div>
  51. <div id="col2">
  52.  
  53. contained left and right divs at 100% height. This design uses a defined body height of 100% which allows setting the
  54. contained left and right divs at 100% height. This design uses a defined body height of 100% which allows setting the
  55. contained left and right divs at 100% height. This design uses a defined body height of 100% which allows setting the
  56. contained left and right divs at 100% height. This design uses a defined body height of 100% which allows setting the
  57.  
  58. </div>
  59. </div>
  60. </div>
  61.  
  62.  
  63.  
  64.  
  65. </body>
  66. </html>


Polecam! smile.gif
elem323
Daiquiri,naprawde dobry jestes.. musisz miec niezle doswiadczenie. Wielkie dzieki, pomogles exclamation.gif!
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.