I would like to make a box-shadow appear darker on one side than another.
I would like to do something like the following:
box-shadow: 2px 3px 6px linear-gradient(90deg, #ccc, #fff);
Is this possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Firefox, at least, won’t let you do this. Firefox only supports
linear-gradientin abackground-imagestyle.Even for browsers that may allow gradients in more places than Firefox does, they probably wouldn’t allow this particular usage. In general, the gradient properties are only meant to work in places in CSS where images are allowed, not to replace “normal” colors.
You could do something sneaky like making a gradient the background-image of an element that’s behind the one you’re setting this box-shadow on, which you could use make it appear like the shadow is darker on one side. That’s going to be quite a bit more complicated in terms of markup and styling, though.