The secret of 8-value border-radius
Most web developers use the border-radius property in a very basic way, giving it a single value (e.g.: border-radius: 10px;) or four values, one for each corner (e.g.: border-radius: 10px 20px 30px 40px;).
But CSS lets you go much further. By using a slash (/), you can define a horizontal radius AND an independent vertical radius for each corner. This is what makes it possible to create complex elliptical shapes, often called Blobs.
How do you read the generated syntax?
The generated code looks like this: border-radius: 51% 49% 70% 30% / 30% 36% 64% 70%;
- Before the slash (/): These are the horizontal values (X axis) for the corners Top-Left, Top-Right, Bottom-Right and Bottom-Left.
- After the slash (/): These are the vertical values (Y axis) for the same corners in the same order.
Use cases in modern web design
These organic shapes (blobs) are extremely popular in contemporary UI design. They are perfect for:
- Creating dynamic, less rigid colored backgrounds behind illustrations.
- Masking profile photos (avatars) with shapes more original than a plain perfect circle.
- Animating the shape on hover (
:hover) to give the button a "breathing" or fluid effect.