CSS Page Curl Effect: How the Folded Corner Illusion Works

Contents
Why does a card corner look like it's curling up like paper?
To your eye, one corner of the card seems to sit slightly off the background, but CSS has no way to fold paper. It isn't a transform rotation or a 3D tilt either. The effect is a two-dimensional illusion built from just two flat background layers.
The first layer is the card background itself. Place "transparent → card color" diagonally with linear-gradient and the one corner you choose is left empty, a triangle with no card color painted in it. Nothing is actually cut away — that spot just doesn't get a background color.
The second layer is a small square (flap) placed exactly over that empty triangle. It's also filled diagonally, half transparent and half the color of the folded back side, so it reads as a triangle. Add a soft shadow in the opposite direction and it looks like that triangle is lifting off the background and casting a shadow.
How to check it: matching the diagonal and shadow values by hand
To build this by hand you have to get three values right at the same time: the diagonal angle of the card background and the fold size, the position and angle of the triangle (flap) you overlay, and the direction the shadow points. For the top-right corner, the card background needs to be cleared along a -135 degree diagonal, and the flap has to sit at the top right of the card at the same size, filled along a 225 degree diagonal, so the edges of the two triangles line up exactly.
The shadow direction changes with each corner too. For the top-right, move the shadow to the lower left; for the top-left, to the lower right — it always has to point away from the fold for the "lifted" look to hold. Reverse the direction and the corner looks dented instead.
Because changing one value means fixing the others, if you grow the fold size from 20px to 30px but leave the flap's width and height alone, the triangle and the empty spot drift out of alignment. And to check it by eye while changing colors, you have to keep going back and forth through these values and refreshing the browser.
Check it with our tool. Pick a corner direction and the diagonal angle, flap position and shadow direction line up automatically. Change size, shadow strength, card color and back color with the sliders and color pickers, and the preview and copyable CSS code update instantly.
Free · No sign-up · Copy the CSS right in your browser

Where people get stuck
Situation
Why it happens
You cast the shadow in the same direction as the triangle
Light appears to come from the other side, so the corner looks dented rather than lifted
You set the card background's diagonal angle and the flap's angle differently
The edges of the two triangles don't match, leaving a crooked line along the folded edge
You increased only the fold size and left the flap's width and height alone
The covering piece is smaller than the triangle cleared out of the background, so a gap shows
You also gave the card corner a large border-radius
The spot where the rounded border meets the sharp diagonal fold looks unnatural
All four cases in the table come down to one question: are the empty spot and the overlaid triangle exactly the same in angle, size and direction? Get even one value wrong and you can see it right away.
In short
The look of a card corner curling up like paper isn't real depth or a 3D transform. It's a 2D illusion: one triangle overlaid on a spot cleared diagonally out of the background, with a shadow cast in the opposite direction.
By hand you'd have to re-match the diagonal angle, flap size and shadow direction for every corner. With a tool that lines those values up as soon as you pick a direction, you can check the colors and size by eye and take the CSS straight from there.
Free · No sign-up · Copy the CSS right in your browser
Frequently asked questions
Is this effect made with CSS 3D transforms?
No. It doesn't use any 3D transforms like rotate3d or perspective. It's a flat (2D) illusion made from two background gradients and a drop-shadow filter, so it works as-is in any modern browser with no extra setup.
How do I adjust the shadow if it looks too soft or too dark?
The shadow strength slider sets the drop-shadow's opacity between 0.05 and 0.6. If you want it fainter or darker, change the last number in the rgba value directly in the CSS you copied.
Can I make the fold much larger than the card?
If the fold grows bigger than the card's width or height, the triangle passes the halfway point of the card and the proportions look broken. It looks natural as long as you keep it at roughly a quarter of the card size or less.
This article was adapted from our Korean original. Read the Korean original