console
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>奇妙的头像</title>
</head>
<body>
<div class="container">
<img
src="https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/b0734ec5bd1449d8933ce76fb4b9a700~tplv-k3u1fbpfcp-watermark.image?"
alt="Kevin Powell"
/>
</div>
</body>
<style>
:root {
--body-bgc-color: rgb(141, 139, 139);
--container-bgc-clor: rgb(201, 199, 199);
}
html,
body {
height: 100vh;
width: 100vw;
}
body {
display: flex;
justify-content: center;
align-items: center;
background-color: var(--body-bgc-color);
}
.container {
width: 400px;
height: 400px;
background-color: var(--container-bgc-clor);
border-radius: 2% 10%;
box-shadow: 10px 10px 10px 0px #616161;
display: flex;
justify-content: center;
align-items: center;
}
img {
--s: 200px;
--b: 5px;
--c: #255b98;
--cb: #f3bf99;
--_g: content-box no-repeat center / calc(100% / var(--f)) 100%;
--_o: calc(
(1 / var(--f) - 1) * var(--s) / 2 - var(--b)
);
--f: 1;
--mh: calc(1px - var(--_o)) / calc(100% / var(--f) - 2 * var(--b) - 2px);
width: var(--s);
aspect-ratio: 1;
padding-top: calc(var(--s) / 5);
cursor: pointer;
border-radius: 0 0 999px 999px;
outline: var(--b) solid var(--c);
outline-offset: var(--_o);
background: radial-gradient(
circle closest-side,
var(--cb) calc(99% - var(--b)),
var(--c) calc(100% - var(--b)),
var(--c) 99%,
transparent 100%
)
var(--_g);
-webkit-mask: linear-gradient(#000 0 0) no-repeat center var(--mh) 50%,
radial-gradient(circle closest-side, #000 99%, #0000) var(--_g);
transform: scale(var(--f));
transition: 0.45s;
}
img:hover {
--f: 1.4;
}
</style>
</html>
img {
--s: 280px;
--b: 5px;
--c: #C02942;
--f: 1;
--_g: 50% / calc(100% / var(--f)) 100% no-repeat content-box;
--_o: calc((1 / var(--f) - 1) * var(--s) / 2 - var(--b));
width: var(--s);
aspect-ratio: 1;
padding-top: calc(var(--s)/5);
cursor: pointer;
border-radius: 0 0 999px 999px;
outline: var(--b) solid var(--c);
outline-offset: var(--_o);
background:
radial-gradient(
circle closest-side,
#ECD078 calc(99% - var(--b)),
var(--c) calc(100% - var(--b)) 99%,
#0000) var(--_g);
mask:
linear-gradient(#000 0 0) no-repeat
50% calc(-1 * var(--_o)) / calc(100% / var(--f) - 2 * var(--b)) 50%,
radial-gradient(
circle closest-side,
#000 99%,
#0000) var(--_g);
transform: scale(var(--f));
transition: .5s;
}
img:hover {
--f: 1.4;
}