Corner-Shape
by Sebastian Kay
HTML
<div class="container">
<div class="box"></div>
</div>
CSS
body {
background: #22c1c3;
background: linear-gradient(
0deg,
rgba(34, 193, 195, 1) 0%,
rgba(253, 187, 45, 1) 100%
);
background-size: 100vw 100vh;
background-repeat: no-repeat;
padding: 0;
margin: 0;
}
.container {
width: min(900px, 80vw);
height: 100vh;
margin: 0 auto 0 auto;
display: flex;
justify-content: center;
align-items: center;
.box {
width: 300px;
height: 300px;
background: white;
border-radius: 1rem;
anchor-name: --box;
transition: 200ms;
&:hover {
corner-top-right-shape: scoop;
border-top-right-radius: 3em;
}
}
.box::before {
scale: 0;
content: '👍';
position: absolute;
position-anchor: --box;
position-area: top right;
translate: -50% 50%;
background: #6c4cff;
color: white;
font-size: 2rem;
line-height: 2rem;
font-weight: bold;
height: 2em;
width: 2em;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
transition: 200ms;
}
.box:hover::before {
scale: 1;
}
.box::after {
content: '';
height: 3em;
width: 3em;
background: transparent;
position: absolute;
position-anchor: --box;
top: anchor(top);
right: anchor(right);
}
}