<article>
<figure><img src="https://assets.codepen.io/605876/person.png" alt=""></figure>
<h2>Mike's mindful morning</h2>
<p>Course • Mindful Mike</p>
</article>
<h1>:hover</h1>
* {
box-sizing: border-box;
}
html {
font-family: sans-serif;
font-weight: 300;
color: hsl(0 0% 15%);
}
h2 {
font-weight: 400;
margin: 2rem 0 0.25rem 0;
}
h1 {
position: fixed;
right: 1rem;
bottom: 1rem;
opacity: 0.5;
margin: 0;
}
p {
margin: 0;
}
body {
display: grid;
place-items: center;
min-height: 100vh;
}
figure {
width: 500px;
aspect-ratio: 8 / 5;
--bg: hsl(330 80% calc(90% - (var(--hover) * 10%)));
--accent: hsl(280 80% 40%);
transition: background 0.2s;
background:
radial-gradient(circle at top left, var(--accent), transparent 75%),
var(--bg);
margin: 0;
position: relative;
overflow: hidden;
border-radius: 1.5rem;
}
figure:after {
content: "";
position: absolute;
width: 20%;
aspect-ratio: 1;
border-radius: 50%;
bottom: 0%;
left: 10%;
background: linear-gradient(-65deg, var(--bg) 50%, var(--accent) 50%);
filter: blur(25px);
transform:
translateX(calc(var(--hover) * 15%))
scale(calc(1 + (var(--hover) * 0.2)));
transition: transform 0.2s, background 0.2s;
}
img {
position: absolute;
left: 20%;
top: 15%;
width: 40%;
transform:
translateX(calc(var(--hover) * -15%))
scale(calc(1 + (var(--hover) * 0.2)));
transition: transform 0.2s;
}
article {
--hover: 0;
}
article:hover {
--hover: 1;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.