Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [HTML][CSS]HTML5 - przeskakujący element
Forum PHP.pl > Forum > Przedszkole
patryk9200
Witam,

Od 2 dni męczę się z problemem w HTML5.
Mianowicie stworzyłem małą stronkę w której obok siebie są po 3 kwadraty na rząd.
Problem w tym, że jeśli wypełnię jakikolwiek kwadrat, to on w tedy przesuwa się w dół.
Co jest przyczyną?
Kod HTML:
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <meta charset="utf-8">
  4. <meta name="Author" content="">
  5. <link rel="Stylesheet" href="css/style.css">
  6. <script src="js/view.js"></script>
  7. <section class="wrapper">
  8. <nav class="top"><a href="java script:ScrollTo('glowna');" >Strona główna</a> <a href="java script:ScrollTo('kontakt');">Kontakt</a> <a href="java script:ScrollTo('cennik');">cennik</a> <a href="java script:ScrollTo('nasze_projekty');">Nasze projekty</a></nav>
  9. <section id="data-wrapper" class="data-wrapper">
  10. <section class="article-wrapper" id="glowna">
  11. <article class="article">
  12. </article>
  13. </section>
  14. <section class="article-wrapper" id="cennik">
  15. <article class="article">test
  16. </article>
  17. </section>
  18. <section class="article-wrapper">
  19. <article class="article">
  20. </article>
  21. </section>
  22. </section>
  23. <section class="data-wrapper">
  24. <section class="article-wrapper">
  25. <article class="article"></article>
  26. </section>
  27. <section class="article-wrapper">
  28.  
  29. <article class="article"></article>
  30. </section>
  31. <section class="article-wrapper">
  32. <article class="article"><time></time></article>
  33. </section>
  34. </section>
  35. <section class="data-wrapper">
  36. <section class="article-wrapper">
  37. <article class="article"></article>
  38. </section>
  39. <section class="article-wrapper">
  40. <article class="article"></article>
  41. </section>
  42. <section class="article-wrapper" id="kontakt">
  43. <article class="article"><time></time></article>
  44. </section>
  45. </section>
  46. <footer></footer>
  47. </body>
  48. </div>
  49. </html>

i CSS:
  1. .top {
  2. position: fixed;
  3. margin-left: 70px;
  4. margin-top: -8px;
  5. }
  6. .top a {
  7. font-size: 30px;
  8. color: silver;
  9. font-family: "Impact", Verdana, sans-serif;
  10. text-decoration: none;
  11. margin-right: 20px;
  12. }
  13. .top a:hover {
  14. font-size: 30px;
  15. color: gray;
  16. font-family: "Impact", Verdana, sans-serif;
  17. text-decoration: none;
  18. margin-right: 20px;
  19. }
  20. html {
  21. margin: 0px;
  22. }
  23. .data-wrapper {
  24. width: 3000px;
  25. height: 100%;
  26. }
  27. .article-wrapper {
  28. width: 880px;
  29. height: 500px;
  30. margin-left: 40px;
  31. margin-top: 40px;
  32. /*border: solid 1px black;*/
  33. display:inline-block;
  34. }
  35. .article {
  36. width: 860px;
  37. height: 480px;
  38. padding: 10px;
  39. }
  40. footer {
  41. height: 100px;
  42. width: 100%;
  43. }
Korab
Wrzuciłbyś jeszcze JS?
croc
A jakbyś dla .article-wrapper dał float: left zamiast display:inline-block?
patryk9200
JavaScript nie ma z tym nic wspólnego, bez JS się dzieje to samo.
Ok, już działa, faktycznie, float: left jest rozwiązaniem, dzięki!
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.