How is the transparency of Css:box-shadow set?

Source: Internet
Author: User
Today we found that using the Box-shadow property, you can add a shadow effect to p, but add the effect if:

-moz-box-shadow:0 4px 4px #999; -webkit-box-shadow:0 4px 4px #999; box-shadow:0 4px 4px #999;

The color set using # is not transparent. This sets the color of the shadow, if the shadow falls in a position that is not white, or even dynamic, such as falling on a slide, several different color pictures are carousel. So setting the color of the shadow will be the shadow effect looks very fake!

WORKAROUND: Use RGBA instead.

-moz-box-shadow:0 4px 4px rgba (0, 0, 0, 0.4); -webkit-box-shadow:0 4px 4px rgba (0, 0, 0, 0.4); box-shadow:0 4px 4px rgba (0, 0, 0, 0.4);

Here to explain:

IE6 and IE7 should not support the Box-shadow property.

Can be used: *filter:progid:dximagetransform.microsoft.shadow (strength=4, direction=135, color= "#888888"); To replace

Because the shadows I set are not necessarily required to be displayed in all browsers. So I did not add this line of code, so there is no validation here will be color= "#888888" in the color with RGBA to replace whether it is feasible, the need for friends to verify their own, estimated to be too tough!

My principles:

As long as it is not layout dislocation and other issues, I will not do compatibility changes.

In order to reduce the number of browsers do not upgrade the stubborn, there is no need to add a line of redundant code, since the use of the old version of the browser, that the effect is not beautiful enough to see is certain.

The reason why a lot of old version of IE browser to exist now, are front-end accustomed to!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.