Fox7777
@Fox7777
Люблю python

Почему когда задаёшь стили 100vw и 100vh и overflow: hidder, всё равно элементы выходят за этот диапазон и появляется скролл?

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="style.css" />
    <title>Document</title>
  </head>
  <body>
    <header>
      <div class="top-header">
        <div class="wrapper">
          <div class="top-header__content">
            <div class="language">
              <button class="active">RU</button>
              <button>EN</button>
            </div>
            <img class="logo" src="./img/logo.svg" alt="" />
            <img class="mobile-logo" src="./img/logo=gradient.svg" alt="" />
            <img class="burger-menu" src="./img/burger.png" alt="" />
            <a href="#">office@royalglobal.market</a>
          </div>
        </div>
      </div>
      <nav class="wrapper">
        <div class="nav-content">
          <a href="#">Главная</a>
          <a href="#">О компании</a>
          <a href="#">Маркет</a>
          <a href="#">Стать партнером</a>
        </div>
      </nav>
    </header>
    <main>
      <div class="main-header">
        <h1>
          Импорт и экспорт <br />
          продуктов по всему миру
        </h1>
        <div class="contant">
          <a href="#">Наши филиалы</a>
        </div>
      </div>
      <div class="footer">
        <div class="main-footer wrapper">
          <div class="main-footer__top-conteiner">
            <div class="main-footer__content">
              <img src="img/Icons 40.png" alt="" />
              <p>Экспорт из страны</p>
            </div>
            <div class="main-footer-pram-footer">
              <div class="main-footer__content">
                <img src="img/tracking.png" alt="" />
                <p>Бизнес внутри страны</p>
              </div>
              <div class="main-footer__content">
                <img src="img/import.png" alt="" />
                <p>Импорт в страну</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </main>
  </body>
</html>

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@300;500&family=Prata&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  color: #fff;
}

.mobile-logo {
  display: none;
}

body {
  width: 100vw;
  height: 100vh;
  background-image: url(img/bg.jpg);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: bottom;
  overflow: hidden;
}

.burger-menu {
  display: none;
}

.wrapper {
  max-width: 1310px;
  margin: 0 auto;
  padding: 0 10px;
}

header {
  width: 100%;
  height: 160px;
  border-bottom: 1px solid #fff;
}

.top-header {
  width: 100%;
  height: 88px;
  border-bottom: 1px solid #fff;
}
.top-header__content {
  height: 88px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.top-header__content a {
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  font-weight: 200;
  text-decoration: none;
  transition: 0.4s;
}
.top-header__content a:hover {
  opacity: 0.6;
}
.top-header__content .language {
  display: flex;
  gap: 20px;
}
.top-header__content .language button {
  padding: 10px 20px;
  border-radius: 25px;
  border: 1px solid #dbdbdb;
  color: #dbdbdb;
  background: transparent;
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  font-weight: 200;
  transition: 0.4s;
}
.top-header__content .language button:active {
  background: #dbdbdb;
  border: 1px solid #dbdbdb;
  color: #050706;
}
.top-header__content .language button.active {
  background: #e7ab38;
  padding: 10px 20px;
  border-radius: 25px;
  border: 1px solid #e7ab38;
  color: #050706;
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  font-weight: 200;
  transition: 0.4s;
}
.top-header__content .language button.active:active {
  border: 1px solid #e7ab38;
  background: #cd911e;
}

.nav-content {
  display: flex;
  height: 72px;
  max-width: 952px;
  margin: 0 auto;
  justify-content: space-between;
  align-items: center;
}
.nav-content a {
  text-decoration: none;
  font-size: 20px;
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
}

.main-header {
  margin: 130px auto 0;
  width: 870px;
  display: flex;
  flex-direction: column;
  gap: 50px;
  align-items: center;
}
.main-header h1 {
  text-align: center;
  font-size: 64px;
  font-family: "Prata", serif;
  font-weight: normal;
}
.main-header a {
  margin-top: 50px;
  font-family: "Montserrat", sans-serif;
  font-size: 20px;
  font-weight: 500;
  color: #050706;
  padding: 10px 68px;
  text-decoration: none;
  background: #e7ab38;
  border-radius: 10px;
}

.main-footer {
  margin-top: 130px;
  width: 100%;
  height: 100%;
  position: relative;
}
.main-footer__top-conteiner {
  position: relative;
  display: flex;
  justify-content: center;
}
.main-footer__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: linear-gradient(#3f3f3f 0 0) padding-box, linear-gradient(to right bottom, #bda976 0%, #edecbb 30%, rgba(193, 149, 62, 0.1) 100%) border-box;
  padding: 40px 20px;
  border: 3px solid transparent;
  border-radius: 20px;
}
.main-footer__content p {
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  font-size: 20px;
}

.main-footer-pram-footer {
  width: 100%;
  top: 92px;
  left: 0;
  position: absolute;
  display: flex;
  justify-content: space-between;
}

.footer {
  position: relative;
}
.footer::before {
  content: "";
  position: absolute;
  background-image: url(./img/Vector.png);
  background-repeat: no-repeat;
  background-size: cover;
  left: -160px;
  top: 100px;
  width: 100%;
  height: 80%;
}

@media (max-width: 428px) {
  .logo, .top-header__content a, .top-header__content .language, nav {
    display: none;
  }
  .wrapper {
    width: 100vw;
    margin: 0;
  }
  header {
    width: 100vw;
    height: 88px;
    border-bottom: none;
  }
  h1 {
    width: 60vw;
    font-size: 40px !important;
  }
  .mobile-logo, .burger-menu {
    display: block;
  }
  .main-header {
    margin-top: 150px;
    width: 100%;
  }
  main {
    height: 70%;
  }
  .main-footer__content {
    padding: 30px 15px;
  }
  .main-footer__content p {
    font-size: 13.5px;
  }
  .footer {
    visibility: hidden;
    width: 608px;
    height: 500px;
    position: absolute;
    left: -100px;
    bottom: 0;
  }
  .footer img {
    width: 30px;
  }
  .main-footer-pram-footer {
    width: 100%;
    top: 92px;
    left: -4%;
    position: absolute;
    display: flex;
    justify-content: space-between;
  }
}/*# sourceMappingURL=style.css.map */

Помогите прошу)
  • Вопрос задан
  • 171 просмотр
Пригласить эксперта
Ответы на вопрос 1
@MaximusMeridius
Добавляем к блоку, который нужно скрыть:
overflow:hidden;
overflow-y:hidden; /*для вертикального*/
overflow-x:hidden; /*для горизонтального*/
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы