A CSS-only wavy divider
Use modern CSS and add a cool Wavy divider to your section. Only one property and two gradients are needed.
.wavy {
--s: 1.6em; /* the size of the wave */
--p: .8; /* the curvature of the wave [0 2] */
--R: calc(var(--s)*sqrt(var(--p)*var(--p) + 1)) at 50%;
mask:
radial-gradient(var(--R) calc(100% - var(--s)*(1 + var(--p))), #000 99%, #0000 101%)
calc(50% - 2*var(--s)) 0/calc(4*var(--s)),
radial-gradient(var(--R) calc(100% + var(--s)*var(--p)), #0000 99%, #000 101%)
50% calc(-1*var(--s))/calc(4*var(--s)) repeat-x;
}
See the Pen CSS-only wavy divider by Temani Afif (@t_afif) on CodePen.
You can also get the code from my online generator.
More detail: css-tricks.com/how-to-create-wavy-shapes-patterns-in-css
More CSS Tips
- CSS-Only pixelated cut corners A few lines of code to create a fancy cut effect using mask.
- Rounded tabs with inner curves A few lines of code to get rounded tabs using CSS mask.
- Smoothly stop a rotation on hover A simple CSS trick to slowly stop a rotation on hover.
- Accelerate a rotation on hover A simple CSS trick to speed up of your rotating element.