Div transparency compatible with IE and Firefox

Source: Internet
Author: User

This is the setting in IE:

Divobj. style. filter = 'progid: DXImageTransform. microsoft. alpha (Enabled = true, opacity = 50, finishopacity = 50, style = 1, startx = 0, finishx = 0, starty = 0, finishy = 0 )'

Simple Writing isDivobj. style. filter: alpha (opacity = 80 );

This is written in Firefox:

Style = "-moz-opacity: 0.8 ;"


# Divobj {
-Moz-opacity: 0.8;

What do we think?

What should we do if we want to be compatible with IE and FF ?? One obvious idea is to first determine the browser type. This will inevitably detect the third type, such as opera. What should I do?

In fact, for opera, Xiao GaN has no way at all.

However, for IE and FF, this step is not required! We can write them together, for example:

# Divobj {
Filter = alpha (opacity = 80 );
-Moz-Opacity = 0.8;

That's all!


First of all, this is certainly acceptable. Xiao GaN has already tested it. In this way, different browsers filter information that they cannot parse .". So we can understand that for IE, he will parse the first sentence; for FF, he will parse the second sentence.

So ......

Most of the time when we boast about browsers, we don't have to look for solutions that both sides can adapt to. We can look for corresponding solutions and then merge them together.

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.