All tools / 04 CSS and design
Nested border radius
When you put a rounded box inside another rounded box, the inner corners need a smaller radius, or the gap looks uneven. Enter two numbers and get the third.
px
The border-radius of the bigger, outside box.
px
The outer box's padding. Add its border width too, if it has one.
Inner box radius
12px
24 − 12 = 12. Rule: inner radius = outer radius − space between.
Inner box
Inner box
Code
CSS
.outer { border-radius: 24px; padding: 12px;}
.inner { border-radius: 12px;}Tailwind classes
outer: rounded-[24px] p-[12px] inner: rounded-[12px]