<ul class="wrapper">
<li>
<a href="">Try hovering</a>
</li>
</ul>
@import url("https://fonts.googleapis.com/css?family=Open+Sans:700");
@property --offset {
syntax: '<length>';
inherits: false;
initial-value: 0;
}
* {
box-sizing: border-box;
}
body {
font-family: "Open Sans", sans-serif;
margin: 0;
padding: 1rem;
background: linear-gradient(45deg, turquoise, darkorchid, deeppink, orange);
color: white;
}
ul {
list-style: none;
font-weight: 700;
font-size: clamp(2rem, 3vw, 3rem);
text-align: center;
}
a {
color: inherit;
text-underline-offset: var(--offset, 0.2em);
text-decoration: underline 0.15em;
transition: --offset 400ms, text-decoration-color 400ms;
}
a:hover,
a:focus {
--offset: 0.4em;
text-decoration-color: orange;
}
@supports not (background: paint(something)) {
a {
transition: text-underline-offset 400ms, text-decoration-color 400ms;
}
a:hover,
a:focus {
text-underline-offset: 0.4em;
}
}
.wrapper {
min-height: 100vh;
width: 100%;
max-width: 50rem;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.