Проблема с эффектом перехода слайда кнопки CSS

У меня проблема с эффектом перехода кнопки. Внутренняя кнопка должна скользить вправо при наведении. Моя ссылка на этот сайт: https://www.grand-forest.gr/. Но все же, я не мог сделать это. Кто-нибудь знает, как это исправить?

Вот мои коды: https://codepen.io/christine-tine27/pen/XWjpowJ

.wrapper {
  padding: 0 40px;
}
.button-inner {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
}
.button-diamond {
    position: relative;
    /* overflow: hidden; */
    width: 3.5vw;
    height: 3.5vw;
    margin: 0.9vw 0.9vw 0.9vw 0.6vw;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    border: 1px solid #383838;
    -webkit-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    transform: rotate(45deg);
    -webkit-transition: border-color 500ms cubic-bezier(.785, .135, .15, .86);
    transition: border-color 500ms cubic-bezier(.785, .135, .15, .86);
}

.button-diamond:hover > .button-diamond-hovered {
    display: block;
       transition: 2s;
  -webkit-transform: translate(0%, 0%);
    -ms-transform: translate(0%, 0%);
    transform: translate(0%, 0%);
}
.button-diamond-arrow-container {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    width: 100%;
    height: 100%;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    transform: rotate(-45deg);
}
.button-diamond-inner {
    position: absolute;
    left: 0%;
    top: 0%;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 100%;
    z-index: 123;
}
.button-diamond-hovered {
    position: absolute;
    /* display: none; */
    left: 0%;
    top: 0%;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 100%;
    background-color: #c8a96a;
    -webkit-transform: translate(-100%, 100%);
    -ms-transform: translate(-100%, 100%);
    transform: translate(-100%, 100%);
}
/* .button-diamond > .button-diamond-hovered {
    display: none;
    transition: 1s;
    -webkit-transform: translate(0%, 0%);
    -ms-transform: translate(0%, 0%);
    transform: translate(0%, 0%);
} */
.arrow-line {
    position: relative;
    width: 40%;
    height: 1px;
    background-color: #383838;
}
.arrow-head {
    position: absolute;
    left: auto;
    top: 0%;
    right: 0%;
    bottom: auto;
    width: 8px;
    height: 8px;
    margin-right: -1px;
    border-top: 1px solid #383838;
    border-right: 1px solid #383838;
    -webkit-transform: translate(0px, 5%) rotate(45deg);
    -ms-transform: translate(0px, 5%) rotate(45deg);
    transform: translate(0px, 5%) rotate(45deg);
    -webkit-transform-origin: 100% 0%;
    -ms-transform-origin: 100% 0%;
    transform-origin: 100% 0%;
}
.arrow-line.arrow-line-white {
    background-color: #faf7f1;
}
.arrow-head.arrow-head-white {
    border-top-color: #faf7f1;
    border-right-color: #faf7f1;
}
.button-text {
    display: inline-block;
    margin-left: 10px;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    -webkit-transition: color 500ms cubic-bezier(.785, .135, .15, .86);
    transition: color 500ms cubic-bezier(.785, .135, .15, .86);
    font-size: 1.5vw;
    line-height: 2.2vw;
}
.home .button {
    display: inline-block !important;
    width: auto !important;
    -webkit-box-pack: start !important;
    -webkit-justify-content: flex-start !important;
    -ms-flex-pack: start !important;
    justify-content: flex-start !important;
    -webkit-box-align: center !important;
    -webkit-align-items: center !important;
    -ms-flex-align: center !important;
    align-items: center !important;
    grid-auto-columns: 1fr !important;
    grid-column-gap: 16px !important;
    grid-row-gap: 16px !important;
    -ms-grid-columns: 1fr 1fr !important;
    grid-template-columns: 1fr 1fr !important;
    -ms-grid-rows: auto auto !important;
    grid-template-rows: auto auto !important;
    color: #383838 !important;
    text-decoration: none !important;
}
.home .button:hover {
    color: #000;
}
.button.slide-in.w-inline-block:hover {
    opacity: 1; transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
    
    }

    .button-diamond-inner:hover {

        transform: translate3d(0%, 0%, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
        }

        .button-diamond-hovered:hover {
            transform: translate3d(-100%, 100%, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
        }
<div class = "wrapper">
   <a href = "#" class = "button slide-in w-inline-block">
      <div class = "button-inner">
         <div class = "button-diamond">
            <div class = "button-diamond-inner">
               <div class = "button-diamond-arrow-container">
                  <div class = "arrow-line">
                     <div class = "arrow-head"></div>
                  </div>
               </div>
            </div>
            <div class = "button-diamond-hovered">
               <div class = "button-diamond-arrow-container">
                  <div class = "arrow-line arrow-line-white">
                     <div class = "arrow-head arrow-head-white"></div>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </a>
</div>
Улучшение производительности загрузки с помощью Google Tag Manager и атрибута Defer
Улучшение производительности загрузки с помощью Google Tag Manager и атрибута Defer
В настоящее время производительность загрузки веб-сайта имеет решающее значение не только для удобства пользователей, но и для ранжирования в...
Введение в CSS
Введение в CSS
CSS является неотъемлемой частью трех основных составляющих front-end веб-разработки.
Как выровнять Div по центру?
Как выровнять Div по центру?
Чтобы выровнять элемент <div>по горизонтали и вертикали с помощью CSS, можно использовать комбинацию свойств и значений CSS. Вот несколько методов,...
Навигация по приложениям React: Исчерпывающее руководство по React Router
Навигация по приложениям React: Исчерпывающее руководство по React Router
React Router стала незаменимой библиотекой для создания одностраничных приложений с навигацией в React. В этой статье блога мы подробно рассмотрим...
Система управления парковками с использованием HTML, CSS и JavaScript
Система управления парковками с использованием HTML, CSS и JavaScript
Веб-сайт по управлению парковками был создан с использованием HTML, CSS и JavaScript. Это простой сайт, ничего вычурного. Основная цель -...
Toor - Ангулярный шаблон для бронирования путешествий
Toor - Ангулярный шаблон для бронирования путешествий
Toor - Travel Booking Angular Template один из лучших Travel & Tour booking template in the world. 30+ валидированных HTML5 страниц, которые помогут...
0
0
74
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Ваша проблема просто скрывает переполнение

        .wrapper {
  padding: 0 40px;
}
.button-inner {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
}
.button-diamond {
    position: relative;
    /* overflow: hidden; */
    width: 3.5vw;
    height: 3.5vw;
    margin: 0.9vw 0.9vw 0.9vw 0.6vw;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    border: 1px solid #383838;
    -webkit-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    overflow: hidden;
    transform: rotate(45deg);
    -webkit-transition: border-color 500ms cubic-bezier(.785, .135, .15, .86);
    transition: border-color 500ms cubic-bezier(.785, .135, .15, .86);
}

.button-diamond:hover > .button-diamond-hovered {
    display: block;
       transition: 2s;
  -webkit-transform: translate(0%, 0%);
    -ms-transform: translate(0%, 0%);
    transform: translate(0%, 0%);
}
.button-diamond-arrow-container {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    width: 100%;
    height: 100%;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    transform: rotate(-45deg);
}
.button-diamond-inner {
    position: absolute;
    left: 0%;
    top: 0%;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 100%;
    z-index: 123;
}
.button-diamond-hovered {
    position: absolute;
    /* display: none; */
    left: 0%;
    top: 0%;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 100%;
    background-color: #c8a96a;
    -webkit-transform: translate(-100%, 100%);
    -ms-transform: translate(-100%, 100%);
    transform: translate(-100%, 100%);
}
/* .button-diamond > .button-diamond-hovered {
    display: none;
    transition: 1s;
    -webkit-transform: translate(0%, 0%);
    -ms-transform: translate(0%, 0%);
    transform: translate(0%, 0%);
} */
.arrow-line {
    position: relative;
    width: 40%;
    height: 1px;
    background-color: #383838;
}
.arrow-head {
    position: absolute;
    left: auto;
    top: 0%;
    right: 0%;
    bottom: auto;
    width: 8px;
    height: 8px;
    margin-right: -1px;
    border-top: 1px solid #383838;
    border-right: 1px solid #383838;
    -webkit-transform: translate(0px, 5%) rotate(45deg);
    -ms-transform: translate(0px, 5%) rotate(45deg);
    transform: translate(0px, 5%) rotate(45deg);
    -webkit-transform-origin: 100% 0%;
    -ms-transform-origin: 100% 0%;
    transform-origin: 100% 0%;
}
.arrow-line.arrow-line-white {
    background-color: #faf7f1;
}
.arrow-head.arrow-head-white {
    border-top-color: #faf7f1;
    border-right-color: #faf7f1;
}
.button-text {
    display: inline-block;
    margin-left: 10px;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    -webkit-transition: color 500ms cubic-bezier(.785, .135, .15, .86);
    transition: color 500ms cubic-bezier(.785, .135, .15, .86);
    font-size: 1.5vw;
    line-height: 2.2vw;
}
.home .button {
    display: inline-block !important;
    width: auto !important;
    -webkit-box-pack: start !important;
    -webkit-justify-content: flex-start !important;
    -ms-flex-pack: start !important;
    justify-content: flex-start !important;
    -webkit-box-align: center !important;
    -webkit-align-items: center !important;
    -ms-flex-align: center !important;
    align-items: center !important;
    grid-auto-columns: 1fr !important;
    grid-column-gap: 16px !important;
    grid-row-gap: 16px !important;
    -ms-grid-columns: 1fr 1fr !important;
    grid-template-columns: 1fr 1fr !important;
    -ms-grid-rows: auto auto !important;
    grid-template-rows: auto auto !important;
    color: #383838 !important;
    text-decoration: none !important;
}
.home .button:hover {
    color: #000;
}
.button.slide-in.w-inline-block:hover {
    opacity: 1; transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
    
    }

    .button-diamond-inner:hover {

        transform: translate3d(0%, 0%, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
        }

        .button-diamond-hovered:hover {
            transform: translate3d(-100%, 100%, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;
        }
    <div class = "wrapper">
        <a href = "#" class = "button slide-in w-inline-block">
           <div class = "button-inner">
              <div class = "button-diamond">
                 <div class = "button-diamond-inner">
                    <div class = "button-diamond-arrow-container">
                       <div class = "arrow-line">
                          <div class = "arrow-head"></div>
                       </div>
                    </div>
                 </div>
                 <div class = "button-diamond-hovered">
                    <div class = "button-diamond-arrow-container">
                       <div class = "arrow-line arrow-line-white">
                          <div class = "arrow-head arrow-head-white"></div>
                       </div>
                    </div>
                 </div>
              </div>
           </div>
        </a>
     </div>

@ChristineSalazar, вы можете отметить это как решение, если оно сработало.

Mahmood Kiaheyrati 14.12.2020 09:16

Другие вопросы по теме