S
S
Sererator2011-08-12 14:32:12
css
Sererator, 2011-08-12 14:32:12

How to get CSS linear-gradient identical to CSS box-shadow (example in explanation)?

We have 2 squares (this is an example for clarity, not the final solution).
jsfiddle.net/zbj6D/
The left box uses the CSS box-shadow property and the right box uses the CSS linear-gradient property. At the same time, the shadow looks smoother than the gradient, even though the gradient seems to use a linear fill. How to achieve identical results?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
almazmusic, 2011-08-12
@almazmusic

First, the gradient doesn't have an identical look due to the settings.
Secondly, box-shadow has an inset property so that the shadow is inside the box, not outside. And then your crutch with the clip puzzled for a few seconds.

L
lahmatiy, 2011-08-13
@lahmatiy

No way. Shadow and gradient are different things, and browsers implement them differently.
For example:
-moz-linear-gradient(top,white 0,black 200px);
gives a result close to the shadow in Firefox (but not the same, apparently because the shadow is not a linear gradient), but in Chrome the result is far from the shadow.

J
jane19n, 2013-12-27
@jane19n

I apologize in advance for the necroposting.
Something remotely similar. jsfiddle.net/jane19n/93t4A

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question