:root{ --white:#fff; --background:#0c7475; } .demo{ background: var(--background); } .link{ color: var(--white); font-family: "Bree Serif", serif; font-size: 22px; font-weight: 500; padding: 2px 6px; letter-spacing: 2px; text-transform: capitalize; display: inline-block; position: relative; transition: all 0.3s ease 0s; } .link:hover, .link:focus{ color: var(--white); text-shadow: 2px -2px rgba(0,0,0,0.15); } .link:after{ content: ""; width: 100%; height: 100%; border: 2px solid #fff; position: absolute; bottom: 0; left: 0; transition: width 0.2s ease 0s,height 0.2s ease 0.1s,border-top-width 0.1s ease 0.2s,margin 0.2s ease 0s; } .link:hover:after{ width: 60%; height: 0; border-width: 0 2px 2px; margin: 0 20%; transition: width 0.2s ease 0.2s,height 0.2s ease 0.1s,border-top-width 0.1s ease 0s,margin 0.2s ease 0.2s; } @media only screen and (max-width: 767px){ .link{ margin-bottom: 30px; } }