Hacker News new | past | comments | ask | show | jobs | submit login
Realistic CSS3 Box Shadow trick with generated content (ballyhooblog.com)
43 points by some1else on Dec 12, 2010 | hide | past | favorite | 12 comments



Why there's a white shadow on top of the black one? Doesn't look natural.


The lighting is incorrect. The shadow makes it look like the post-it note is actually just a ring of paper. A real shadow wouldn't just magically turn white/transparent as it gets further in from the edge, especially since the part that looks odd is tucked under the paper, and, in the physical world, would be darker since it's more hidden from the light source.

I wrote a blog entry a few months ago on how to achieve realism with respect to digital light sources, maybe it'll help someone out: http://flyosity.com/tutorial/crafting-subtle-realistic-user-...


You're correct. However, I think the described technique with generated content and transforms of multiple box shadows can be used to achieve realistic simulations of lighting, like the kinds in your blog post.

The author's idea of realistic lighting effects indeed doesn't take into account the perspective of the curl on the note, and therefore looks a bit unnatural.

P.s.: Great post.


Agreed. It’s one of the simplest guides to adding subtle texture to widgets out there, with the added bonus of being concise.


I think the reason for this is that when you move an object further away from a surface the shadow becomes less pronounced and more diffuse.

I agree that it doesn't look quite right, though.


I prefer the "boring" shadows. They look cleaner.


Someone posted another way to do this the other day: http://matthamm.com/box-shadow-curl.html (http://news.ycombinator.com/item?id=1988977)

It looks much nicer. Plus, calling the curl effect "realistic" is quite the exaggeration.


Please don't use this version of the effect. I've seen in on a couple of websites, and it seriously pains me to see it.

Because the "page" doesn't actually "curl", it looks more like background has been pushed down in places.


I’m guessing they used it on a large element. Something like this is definitely meant for a sub-300px element, where the eye would get tricked into thinking there was a page curl.


Great one, quite decent.


That's a janky lookin shadow my friend!


And CSS Transforms :-)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: