Gravity-Defying Page Corners
While working on Stikkit, a “page curl” came to be.
Not being as crafty as Veerle, you see.
I fired up Photoshop to see what could be.
“Another copy is running on the network“ … oopsie.
With license issues sorted out and a concept in mind
I set out to create something flexible and refined.
One background image and code that is sure to be lean.
A simple solution for lazy people like me.
The curl I’ll be showing isn’t a curl at all.
It’s simply a gradient that’s 18 pixels tall.
With a fade to the left that’s diagonally aligned
and a small fade on the right that keeps the illusion defined.
Create a selection with the marquee tool (keeping in mind a reasonable minimum width) and drag a gradient (black to transparent) from top to bottom.
Now drag a gradient (the background color of the page to transparent) from the bottom left corner to the top right corner.
Finally, drag another gradient from the right edge towards the center, about 20 pixels or so.
But the top is flat and can be positioned precisely
just under the bottom right edge very nicely.
And there it will sit, never ever to be busted
by varying sizes of text when adjusted.
<div id="page">
<div id="page-contents">
<h2>Gravity-Defying!</h2>
<p>Lorem ipsum dolor ...</p>
</div>
</div>
Let’s dive into code and in the markup you’ll see
“is that an extra div?” … please don’t kill me?
The #page
div sets the width and bottom padding
whose height is equal to the shadow we’re adding.
The #page-contents
div will set padding in ems
to scale with the text size the user intends.
The background color will be added here too
but not overlapping the shadow where #page
’s padding makes room.
A simple technique that you may find amusing
is to substitute a PNG for the GIF I was using.
For that would be crafty and future-proof, too.
The page curl could sit on any background hue.
I hope you’ve enjoyed this easy little trick.
It’s hardly earth-shattering, and arguably slick.
But it could come in handy, you just never know.
Happy Holidays! And pleasant dreams of web three point oh.
About the author
Dan Cederholm is a web designer and author based in Salem, Massachusetts. He’s the founder of SimpleBits, a tiny web design studio. He’s writes and speaks (in non-poetic form) about interface design during the day, and plays the ukulele and drinks wine at night.