0

Возможно, проблема во вложенности less


  .HamburgerMenu{
background: #000000;

@media screen and (max-width: 686px) {
  background: none;
}


&_Btn {
  display: none;
  position: fixed;
  top: 2px;
  left: 20px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  z-index: 1;


  @media screen and (max-width: 686px) {
    display: flex;
    align-items: center;
  }

  &--span{

    display: block;
    position: relative;
    width: 100%;
    height: 2px;
    background-color: #fff;
    transition: 0.3s;


    &::after {
      content:'';
      display: block;
      position: absolute;
      width: 100%;
      height: 2px;
      background-color: #fff;
      transition: 0.3s;
      top: 8px;

    }
    &::before {
      content: '';
      display: block;
      position: absolute;
      width: 100%;
      height: 2px;
      background-color: #fff;
      transition: 0.3s;
      top: -8px;
    }

  }
}
}

.MenuBox{
display: flex;
align-items: center;
list-style: none;

@media screen and (max-width: 686px){
  display: block;
  position: fixed;
  visibility: hidden;
  top: 0;
  left: -300px;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 80px 0;
  list-style: none;
  text-align: center;

  background-color:#000000;
  box-shadow: 0 0 0 9999px rgba(25, 25, 25, 0.3);
  opacity: 0.8;
  transition: 0.3s;

}

&_Item{
  display: block;
  padding: 10px 18px;
  color: #fff;
  font-family: 'Roboto', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;

  @media screen and (max-width: 686px){
    color: #333;
  }

  &:hover{
    background-color: #CFD8DC;
  }
}
}

#MenuToggle {
display: none;
}

#MenuToggle:checked ~ .HamburgerMenu_Btn--span {
transform: rotate(90deg);
}

#MenuToggle:checked ~ .HamburgerMenu_Btn--span::before {
top: 0;
transform: rotate(0);
}

#MenuToggle:checked ~ .HamburgerMenu_Btn--span::after {
top: 0;
transform: rotate(90deg);
}

#MenuToggle:checked ~ .MenuBox {
visibility: visible;
left:0;



}

1 ответ 1

3

Должно быть &::after и &::before вместо того что сейчас

3
  • Не помогло. Я отредактировал код и прислал полностью на меню. Возможно там ошибки
    – DenRum
    23 окт 2020 в 10:12
  • Ну страница состоит не только из CSS. Понять что у вас там происходит не возможно. Отредактируйте пример чтобы запускался здесь, тогда больше шанс что вам помогут.
    – user347472
    23 окт 2020 в 15:19
  • Спасибо! Уже сам решил)
    – DenRum
    2 ноя 2020 в 5:08

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.