Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [HTML][CSS] Odstęp między 2 divami
Forum PHP.pl > Forum > Przedszkole
Matado
Mam problem dot. 2 divów. W divie "main" są dwa divy: menu i news. Chcę aby były oddalone o siebie o np. 100px i np. 200px od góry i 150 z lewej strony. Nie mogę ustawić tego za pomocą margin: . Macie jakieś pomysły, żeby ustawić tak te divy?

Chodzi mi o coś takiego: http://i40.tinypic.com/21j90xz.jpg

XHTML
Kod
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head>
   <title>WOW Info</title>
   <link rel="Stylesheet" type="text/css" href="style.css" />
</head>
<body>

<div id="wrapper">
<div id="top">
Logo
</div>    
<div id="main">
    <div id="menu">
    Menu
    </div>
    <div id="news">
    News
    </div>
</div>
<div id="footer">
Footer
</div>

</div>
</body>
</html>

CSS:
Kod
html, body {
    background-color: #000;
    color: #000;
    margin: 0;
    padding: 0;
}

#wrapper {
    width: 1000px;
    margin: auto;
}

#top {
    background-image: url(images/top.jpg);
    height: 23px;
}

#main {
    overflow: hidden;
    background-image: url(images/main.jpg);
    height: 755px;
}

#footer {
    clear: both;
    width: 100%;
    height: 22px;
    background-image: url(images/footer.jpg);
}

#menu {
    width: 190px;
    float: left;
    border: solid 1px green;
    overflow: hidden;
}

#news {
    width: 500px;
    float: left;
    border: solid 1px green;
    overflow: hidden;
}
krzysiekk
witam czy o to ci chodzi podmień swojego css-a

  1. html, body {
  2. background-color: #cccccc;
  3. color: #000;
  4. margin: 0;
  5. padding: 0;
  6. }
  7.  
  8. div#wrapper {
  9. width: 1000px;
  10. margin: 0 auto;
  11. border:1px solid #ff0000;
  12. }
  13.  
  14. div#top {
  15. background-image: url(images/top.jpg);
  16. height: 23px;
  17. border:1px solid #ff0000;
  18. }
  19.  
  20. div#main {
  21. overflow: hidden;
  22. background-image: url(images/main.jpg);
  23. height: 755px;
  24. }
  25.  
  26. div#footer {
  27. clear: both;
  28. width: 100%;
  29. height: 22px;
  30. background-image: url(images/footer.jpg);
  31. }
  32.  
  33. div#menu {
  34. width: 190px;
  35.  
  36. margin:50px 0 0 100px;
  37. float: left;
  38. border: solid 1px green;
  39. overflow: hidden;
  40. }
  41.  
  42. div#news {
  43. width: 500px;
  44. margin:50px 0 0 50px;
  45. float: left;
  46. border: solid 1px green;
  47. overflow: hidden;
  48. }
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.