Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [css] Div przeskakuje do nowego wiersza
Forum PHP.pl > Forum > Przedszkole
poxrimex
Witam!

Mam problem, gdyż div "tresc" przeskakuje mi do nowego wiersza zamiast byc w tym samym co div "menu". W Htmlu nic nie ma innego tylko kilka literek oraz same divy. A oto plik css:

  1. html, body
  2. {
  3. color: #494949;
  4. font-family: Tahoma, Helvetica, Verdana, sans-serif;
  5. text-align: center;
  6. font-size: 12px;
  7. margin-top: 0;
  8. margin-left: 0;
  9. margin-right: 0;
  10. margin-bottom: 0;
  11. }
  12.  
  13. #site
  14. {
  15. background-color: black;
  16. width: 800;
  17. margin-top: 80;
  18. margin-left: auto;
  19. margin-right: auto;
  20. }
  21.  
  22. #menu
  23. {
  24. background-color: blue;
  25. width: 220px;
  26. float: left;
  27. margin-left:10px;
  28. margin-right: auto;
  29. }
  30.  
  31. #tresc
  32. {
  33. background-color: yellow;
  34. width: 300px;
  35. float: right;
  36. margin-left: 500px;
  37. margin-right: 0px;
  38. }
gekon
Pokaż tę parę literek w HTMLu.
poxrimex
Proszę bardzo:

  1. <div id="site">
  2. <div id="menu">
  3. tekst2
  4. </div>
  5. <div id="tresc">
  6. tekst1
  7. </div>
  8. </div>
gekon
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html lang="pl">
  3. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  4. <style type="text/css">
  5. html, body
  6. {
  7. color: #494949;
  8. font-family: Tahoma, Helvetica, Verdana, sans-serif;
  9. text-align: center;
  10. font-size: 12px;
  11. margin: 0;
  12. }
  13.  
  14. #site
  15. {
  16. background-color: black;
  17. width: 800px;
  18. margin: 80px auto 0 ;
  19. }
  20.  
  21. #menu
  22. {
  23. background-color: blue;
  24. width: 220px;
  25. float: left;
  26. margin: 0 0 0 10px;
  27. }
  28.  
  29. #tresc
  30. {
  31. background-color: yellow;
  32. width: 300px;
  33. float: right;
  34. margin: 0;
  35. }
  36. </style>
  37. </head>
  38. <div id="site">
  39. <div id="menu">
  40. tekst2
  41. </div>
  42. <div id="tresc">
  43. tekst1
  44. </div>
  45. </div>
  46. </body>
  47. </html>

Niepotrzebny margines dla #tresc, pyzatym zapomniałeś dać jednostek dla szerokości i marginesu w #site.
Edyta:
Polecam dobry kurs.
poxrimex
jeszcze mam problem gdyż mozilla zachowuje się jakby nie widzała diva "site"
grzesiek_g
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html lang="pl">
  3. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  4. <style type="text/css">
  5. html, body
  6. {
  7. color: #494949;
  8. font-family: Tahoma, Helvetica, Verdana, sans-serif;
  9. text-align: center;
  10. font-size: 12px;
  11. margin: 0;
  12. }
  13.  
  14. #site
  15. {
  16. background-color: black;
  17. width: 800px;
  18. margin: 80px auto 0 ;
  19.  
  20. /*dodaj to lub kod przy którym jest poniżej komentarz*/
  21. overflow:auto;
  22. }
  23.  
  24. #menu
  25. {
  26. background-color: blue;
  27. width: 220px;
  28. float: left;
  29. margin: 0 0 0 10px;
  30. }
  31.  
  32. #tresc
  33. {
  34. background-color: yellow;
  35. width: 300px;
  36. float: right;
  37. margin: 0;
  38. }
  39. </head>
  40. <div id="site">
  41. <div id="menu">
  42. tekst2
  43. </div>
  44. <div id="tresc">
  45. tekst1
  46. </div>
  47.  
  48. <br style="clear:both" />
  49.  
  50. </div>
  51. </body>
  52. </html>
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.