<h3 class="hover-1">Hover Me</h3>
<h3 class="hover-2">Hover Me</h3>
<h3 class="hover-3">Hover Me</h3>
<h3 class="hover-4">Hover Me</h3>
.hover-1 {
--c: #1095c1; /* the color */
--s: .15em;
line-height:1.1em;
padding-bottom: calc(2.1*var(--s));
background:
conic-gradient(from 135deg at top,var(--c) 90deg,#0000 0)
left 0 bottom var(--s)/calc(2*var(--s)) var(--s) repeat-x,
conic-gradient(from -45deg at bottom,var(--c) 90deg,#0000 0)
left var(--s) bottom 0/calc(2*var(--s)) var(--s) repeat-x;
-webkit-mask:
linear-gradient(#000 0 0) content-box,
linear-gradient(#000 0 0) 0/var(--_p,0%) padding-box no-repeat;
transition: .5s;
}
.hover-1:hover {
--_p: 100%;
color: var(--c);
}
.hover-2 {
--c: #1095c1; /* the color */
--b: .1em; /* border length*/
--d: 20px; /* the cube depth */
--_s: calc(var(--d) + var(--b));
color: var(--c);
border: solid #0000;
border-width: var(--b) var(--b) var(--_s) var(--_s);
background:
conic-gradient(at left var(--d) bottom var(--d),
#0000 90deg, rgb(255 255 255 /0.3) 0 225deg,rgb(255 255 255 /0.6) 0) border-box,
conic-gradient(at left var(--_s) bottom var(--_s),
#0000 90deg,var(--c) 0) 0 100%/calc(100% - var(--b)) calc(100% - var(--b)) border-box;
transform: translate(calc(var(--d)/-1),var(--d));
clip-path:
polygon(
var(--d) 0%,
var(--d) 0%,
100% 0%,
100% calc(100% - var(--d)),
100% calc(100% - var(--d)),
var(--d) calc(100% - var(--d))
);
transition: 0.5s;
}
.hover-2:hover {
transform: translate(0,0);
clip-path:
polygon(
0% var(--d),
var(--d) 0%,
100% 0%,
100% calc(100% - var(--d)),
calc(100% - var(--d)) 100%,
0% 100%
);
}
.hover-3 {
--b: 0.1em; /* the thickness of the line */
--c: #1095c1; /* the color */
color: #0000;
padding-block: var(--b);
background:
linear-gradient(var(--c) 50%,#000 0) 0% calc(100% - var(--_p,0%))/100% 200%,
linear-gradient(var(--c) 0 0) 0% var(--_p,0%)/var(--_p,0%) var(--b) no-repeat;
-webkit-background-clip: text,padding-box;
background-clip: text,padding-box;
transition: .3s var(--_s,0s) linear,background-size .3s calc(.3s - var(--_s,0s));
}
.hover-3:hover {
--_p: 100%;
--_s: .3s;
}
.hover-4 {
border: 8px solid;
border-image: repeating-linear-gradient(135deg,#F8CA00 0 10px,#E97F02 0 20px,#BD1550 0 30px) 8;
-webkit-mask:
conic-gradient(from 180deg at top 8px right 8px, #0000 90deg,#000 0)
var(--_i,200%) 0 /200% var(--_i,8px) border-box no-repeat,
conic-gradient(at bottom 8px left 8px, #0000 90deg,#000 0)
0 var(--_i,200%)/var(--_i,8px) 200% border-box no-repeat,
linear-gradient(#000 0 0) padding-box no-repeat;
transition: .3s, -webkit-mask-position .3s .3s;
}
.hover-4:hover {
--_i: 100%;
color: #CC333F;
transition: .3s, -webkit-mask-size .3s .3s;
}
body {
height: 100vh;
margin: 0;
display: grid;
grid-template-columns: auto auto;
gap: 20px 50px;
place-content: center;
align-items: end;
}
h3 {
font-family: system-ui, sans-serif;
font-size: 4rem;
margin:0 auto;
cursor: pointer;
padding: 0 .1em;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.