Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, all CSS shadows are emulated. CSS doesn't have a lighting engine. The docs you are thinking of [0] suggest that elevation is suggested by shadow morphology. Actual elevation in CSS (3D translations along the Z-axis) is useful for scaling effects to create a sense of perspective, but Material guidelines dictate you should just keep it simple and emulate a light source from which you derive a set of emulated shadows.

What works for me in this case is a Sass mixin which accepts a layer as an integer in the range 1-N and casts a shadow based on that layer and the total depth N. Consistency is key.

[0] https://material.io/design/environment/light-shadows.html#sh...

[1] https://material.io/design/environment/elevation.html#depict...



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

Search: