.link{ color: #333; font-family: 'Heebo', sans-serif; font-size: 25px; font-weight: 500; text-transform: lowercase; line-height: 21px; display: inline-block; overflow: hidden; position: relative; z-index: 1; transition: all 0.3s ease 0.2s; } .link:hover, .link:focus{ color: #8B4513; } .link:before{ content: ""; background: #FFDAB9; width: 100%; height: 20%; opacity: 0; position: absolute; right: 0; top: 0; z-index: -1; transition: all 0.3s ease 0s; } .link:hover:before, .link:focus:before{ animation: animate 0.5s linear; } @keyframes animate{ 0%,100%{ opacity: 1; background-color: #FFDAB9; top: 0; } 50%{ background-color: #8B4513; top: 80%; } } @media only screen and (max-width: 767px){ .link{ margin-bottom: 30px; } }