CSS setting element Transparency code Instance

Source: Internet
Author: User

CSS settings element Transparency code example:
This section describes how to set the transparency of an element, which is now used for many effects, and describes how to achieve this effect.
The opacity provides a standard set of properties for transparency, which is between 0-1, 0 is completely transparent, and 1 is completely opaque.
The code is as follows:

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.softwhy.com/" /><title>Ant Tribe</title><styletype= "Text/css">Div{width:100px;Height:100px;background:Red;Opacity:0.3;}</style></Head><Body><Div></Div></Body></HTML>

The above code works perfectly in Google and Mozilla Firefox, but not in the IE8 and IE8 browsers because they do not support opacity properties.
The code is modified as follows:

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.softwhy.com/" /><title>Ant Tribe</title><styletype= "Text/css">Div{width:100px;Height:100px;background:Red;Opacity:0.3;Filter:Alpha (opacity=30);}</style></Head><Body><Div></Div></Body></HTML>

The above code implements our requirements, that is, add Filter:alpha (opacity=30), this IE browser support, it is important to note that the opacity value in parentheses is 0-100, 0 is completely transparent, 100 is completely opaque.

The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=12918

For more information, refer to: http://www.softwhy.com/divcss/

CSS setting element Transparency code Instance

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.