Боковые панели остаются на дне, а не сдвигаются в сторону. HTML / CSS - PullRequest
0 голосов
/ 11 апреля 2020

Я новичок в HTML и CSS, и я следил за видеоуроком, если он двигался быстро, но я не торопился с этим, и его боковые панели, казалось, автоматически перемещались из нижней части страницы вправо сторона после того, как он удалил тег overflow: hidden;. Я также удалил его, но мой остался на месте.

Я что-то упустил? Мне интересно, может ли это быть просто рендерингом на моем устройстве, потому что когда я запускаю здесь фрагмент кода, он идет в сторону, как и должно быть, но я пытаюсь понять, ПОЧЕМУ он идет в сторону, но не на какой-либо из браузеры я примеряю

body {
  background-color: #999;
  color: #000305;
  font-size: 87.5%;
  /*Base font size is 14px */
  font-family: Arial, 'Lucida Sans Unicode';
  line-height: 1.5;
  text-align: left;
}

a {
  text-decoration: none;
}

a:link,
a:visited {
  color: #CF5C3F;
}

a:hover,
a:active {
  background-color: #CF5C3F;
  color: #FFF;
}

.body {
  margin: 0 auto;
  width: 70%;
  clear: both;
}

.mainHeader img {
  width: 30%;
  height: auto;
  margin: 2% 0;
}

.mainHeader nav {
  background-color: #666;
  height: 40px;
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
}

.mainHeader nav ul {
  list-style: none;
  margin: 0 auto;
}

.mainHeader nav ul li {
  float: left;
  display: inline;
  text-align: center;
}

.mainHeader nav a:link,
.mainHeader nav a:visited {
  color: #FFF;
  display: inline-block;
  padding: 10px 20px;
  height: 20px;
}

.mainHeader nav a:hover,
.mainHeader nav a:active,
.mainHeader nav .active a:link,
.mainHeader nav .active a:visited {
  background-color: #CF5C3F;
  text-shadow: none;
}

.mainHeader nav ul li a {
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
}

.mainContent {
  line-height: 25px;
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
}

.content {
  width: 70%;
  float: left;
}

.topcontent {
  background-color: #FFF;
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  padding: 3% 5%;
  margin-top: 2%;
}

.bottomcontent {
  background-color: #FFF;
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  padding: 3% 5%;
  margin-top: 2%;
}

.top-sidebar {
  width: 21%;
  float: left;
  background-color: #FFF;
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  margin: 2% 0 2% 3%;
  padding: 2% 3%;
}

.post-info {
  font-style: italic;
  color: #999;
  font-size: 85%;
}

.middle-sidebar {
  width: 21%;
  float: left;
  background-color: #FFF;
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  margin-left: 3%;
  margin-bottom: 2%;
  padding: 2% 3%;
}

.bottom-sidebar {
  width: 21%;
  float: left;
  background-color: #FFF;
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  margin-left: 3%;
  margin-bottom: 2%;
  padding: 2% 3%;
}

.mainFooter {
  width: 100%;
  height: 40px;
  float: left;
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  background-color: #666;
  margin: 2% 0;
}

.mainFooter p {
  width: 92%;
  margin: 10px auto;
  color: #FFF;
}

@media only screen and (min-width: 150px) and (max-width: 600px) {
  .body {
    width: 90%;
    font-size: 95%;
  }
  .mainHeader img {
    width: 100%;
  }
  .mainHeader nav {
    height: 160px;
  }
  .mainHeader nav ul {
    padding-left: 0;
  }
  .mainHeader nav ul li {
    width: 100%;
    text-align: center;
  }
  .mainHeader nav a:link,
  .mainHeader nav a:visited {
    padding: 10px 25px;
    height: 20px;
    display: block;
  }
  .content {
    width: 100%;
    float: left;
    margin-top: 2%;
  }
  .post-info {
    display: none;
  }
  .topcontent {
    background-color: #FFF;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    padding: 3% 5%;
    margin-top: 2%;
    margin-bottom: 4%;
  }
  .bottomcontent {
    margin-top: 3%;
  }
  .top-sidebar,
  .middle-sidebar,
  .bottom-sidebar {
    width: 94%;
    margin: 2% 0 2% 0;
    padding: 2% 3%;
  }
}
<!DOCTYPE html>
<html lang="en">

<head>
  <title>Text</title>
  <meta charset="utf-8" />

  <link rel="stylesheet" href="style.css" type="text/css" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>

<body class="body">

  <header class="mainHeader">
    <img src="img/logo.gif" alt="Smiley gif" />

    <nav>
      <ul>
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#">About</a></li>
        <li><a href="#">Portfolio</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </nav>
  </header>

  <div class="mainContent">
    <div class="content">
      <article class="topcontent">
        <header>
          <h2><a href="#" title="First post">Text</a></h2>
        </header>

        <footer>
          <p class="post-info">Text</p>
        </footer>

        <content>
          <p>Text</p>
          <p>Text</p>
        </content>
      </article>

      <article class="bottomcontent">
        <header>
          <h2><a href="#" title="Second post">Text</a></h2>
        </header>

        <footer>
          <p class="post-info">Text</p>
        </footer>

        <content>
          <p>Text</p>
          <p>Text</p>
        </content>
      </article>

    </div>
  </div>

  <aside class="top-sidebar">
    <article>
      <h2>Top sidebar</h2>
      <p>Text</p>
    </article>
  </aside>

  <aside class="middle-sidebar">
    <article>
      <h2>Middle sidebar</h2>
      <p>Text</p>
    </article>
  </aside>

  <aside class="bottom-sidebar">
    <article>
      <h2>Bottom sidebar</h2>
      <p>Text</p>
    </article>
  </aside>

  <footer class="mainFooter">
    <p>Copyright &copy; 2013 <a href="#" title="Text">Text</a></p>
  </footer>

</body>

</html>
...