4 ms·
I can't find it anymore, but the Material Design Guidelines had a thing at some point which warned against emulating shadows in place of actually changing eleva
by saagarjha 8y ago
I can't find it anymore, but the Material Design Guidelines had a thing at some point which warned against emulating shadows in place of actually changing elevation.
- soulofmischief 8y agoWell, 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#shadows https://material.io/design/environment/light-shadows.html#sh... [1] https://material.io/design/environment/elevation.html#depicting-elevation https://material.io/design/environment/elevation.html#depict...