:root{ --white: #fff; --color1: #3c6382; --color2: #0a3d62; } .link{ color: transparent; font-family: 'Mulish', sans-serif; font-size: 22px; font-weight: 700; padding: 2px 6px; text-transform: capitalize; display: inline-block; border: none; overflow: hidden; position: relative; transition: all 0.3s ease 0s; z-index: 1; } .link:hover, .link:focus{ color: transparent; } .link:before, .link:after{ content: attr(data-hover); color: var(--white); background: var(--color1); width: 100%; height: 100%; padding: 2px 6px; position: absolute; top: 0; left: 0; transition: all 0.5s; z-index: -1; } .link:after{ background: var(--color2); opacity: 0; left: -100%; transform: scale(0) rotateY(0deg); } .link:hover:before{ left: 100%; transform: scale(0) rotateY(360deg); opacity: 0; } .link:hover:after{ left: 0; transform: scale(1) rotateY(360deg); opacity: 1; } @media only screen and (max-width: 767px){ .link{ margin-bottom: 30px; } }