L
L
losos_lapolosos2020-05-13 20:03:56
css
losos_lapolosos, 2020-05-13 20:03:56

Why does the vertical scroll disappear when adding the position:fixed property to the header?

Here is the html:

<header>
    <div class="bg">
      <div class="container">
        <div class="top-contact">
          <div class="RusNum">8 800 231-54-93 Бесплатно по России</div>
          <div class="PitNum">8 981 822-25-30 Санкт-Петербург</div>
          <div class="mail">[email protected]</div>
        </div>
      </div>
    </div>
    <div class="container">				
      <div class="menu">
        <div class="logo"><img src="img/logo.png" alt="Логотип"></div>
        <nav class="desktopNav">
          <a href="#" class="ArticleOfMenu">Главная</a>
          <a href="#" class="ArticleOfMenu">О продукте</a>
          <a href="#" class="ArticleOfMenu">Как это работает</a>
          <a href="#" class="ArticleOfMenu">Применение</a>
          <a href="#" class="ArticleOfMenu">Контакты</a>
        </nav>
        <div class="call"><a class="callButton" id="btn_modal_window">Звонок</a></div>
      </div>
    </div>
</header>

Here is the css:
header{
  width: 100%;
  position: fixed;

}

.bg{
  background: #E1E1E1;
}

.top-contact{
  display: -webkit-flex;
  display: -moz-flex;
  display: -ms-flex;
  display: -o-flex;
  display: flex;
  justify-content: space-between;
  font-weight: 400;
  padding: 10px 0;
}

.menu{
  background: #fff;
  display: -webkit-flex;
  display: -moz-flex;
  display: -ms-flex;
  display: -o-flex;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 0;
}

.logo{
  width: 25%;
}

.logo img{
  width: 100%;
  max-width: 182px;
  height: auto;
}

.desktopNav{
  font-weight: 500;
  display: -webkit-flex;
  display: -moz-flex;
  display: -ms-flex;
  display: -o-flex;
  display: flex;
  justify-content: center;
  width: 100%;
}

.desktopNav a{
  padding: 10px;
  border-bottom: 2px solid #30A261;
  text-decoration: none;
  color: #000;
  text-align: center;
  margin-left: 1%;
}

.desktopNav a:hover{
  background: #30A261;
  transform: translateY(-10px);
  color: #fff;
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -ms-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
  transition: 0.5s ease all;
}

.desktopNav a:not(:hover){
  background: #fff;
  transform: translateY(0);
  color: #000;
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -ms-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
  transition: all 0.5s ease
}


@keyframes moving{
  from{
    transform: translateX(3px);
  }
  20%{
    transform: translateX(-6px);
  }
  40%{
    transform: translateX(3px);
  }
  60%{
    transform: translateX(-6px);
  }
  80%{
    transform: translateX(3px);
  }
  to{
    transform: translateX(0px);
  }
}


.call a{
  display: block;
  padding: 12px 30px;
  border: 2px solid #30A261;
  text-decoration: none;
  color: #30A261;
  cursor: pointer;
}

.call a:hover{
  animation-name: moving;
  animation-duration: 0.5s;
  background: #30A261;
  color: #fff;
  -webkit-transition: all 0.25s ease;
  -moz-transition: all 0.25s ease;
  -ms-transition: all 0.25s ease;
  -o-transition: all 0.25s ease;
  transition: all 0.25s ease
}

.call a:not(:hover){
  background: #fff;
  color: #30A261;
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -ms-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question