A Pen by Ilham Widayat on CodePen.
Created
February 22, 2025 20:47
-
-
Save PushoDev/fc4e9b6db3e302e51ff92b24aa1ef630 to your computer and use it in GitHub Desktop.
inverted border-radius with box-shadow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="inverted-border-radius"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body | |
display: flex | |
align-items: center | |
justify-content: center | |
height: 100vh | |
width: 100vw | |
$width-border: 200px | |
$half-border: $width-border/2 | |
$quad-border: $half-border/2 | |
$half-border-inverted: $half-border * -1 | |
$color: #f00 | |
.inverted-border-radius | |
position: relative | |
height: $half-border | |
width: $half-border | |
background-color: $color | |
border-radius: 0 50% 50% 0 | |
&::before | |
content: "" | |
position: absolute | |
background-color: transparent | |
top: -$width-border | |
height: $width-border | |
width: $quad-border | |
border-bottom-left-radius: $half-border | |
box-shadow: 0 $half-border 0 0 $color | |
&::after | |
content: "" | |
position: absolute | |
background-color: transparent | |
bottom: -$width-border | |
height: $width-border | |
width: $quad-border | |
border-top-left-radius: $half-border | |
box-shadow: 0 $half-border-inverted 0 0 $color |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment