Study and practice of opacity attribute in CSS3

Source: Internet
Author: User

How is the opacity attribute used in CSS3?:<length> inherit

Length: A value of 0 to 1, consisting of floating-point numbers and unit identifiers. is not a negative value. The default value is: 1.

The function of this label is to declare the transparency of an element, and the element with a value of 1 is completely opaque, whereas a value of 0 is completely opacity and invisible. Any value from 1 to 0 indicates the degree of transparency of the element.

Compatible: Firefox 3.0.10, Chrome 2.0.x, Opera 9.64, Safari 4, Firefox 3.5

The older version of Firefox, we need to use the-moz-prefix, and for the old Safari/chrome version, we need to use the-webkit-prefix. For the older safari version that uses the khtml kernel instead of the WebKit kernel, we need to use-khtml-. So if we want to support every browser, our code should be like this: opacity:0.5; -moz-opacity:0.5; -webkit-opacity:0.5; -khtml-opacity:0.5;

For IE does not support using a filter: Filter:alpha (opacity=50), ie we need to use integers from 0 to 100, IE8 provides a new way to place:-ms-filter: "Progid:d XImageTransform.Microsoft.Alpha (opacity=50) ";

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > < HTML xmlns= "http://www.w3.org/1999/xhtml" > <pead> <meta http-equiv= "Content-type" content=; Charset=utf-8 "/> <meta http-equiv= content-language" content= "Utf-8"/> <meta name= "robots" content= "all" /> <meta name= "Author" content= "TENCENT-ISRD"/> <meta name= "Copyright" content= "Tencent"/> <style > img.opacity1 {opacity:0.25} img.opacity2 {opacity:0.50;} img.opacity3 {opacity:0.75;} </style> <TITLE&G t;opacity</title> </pead> <body> <div></div> <div></div> < Div></div> </body> </ptml> </ textarea> </p>



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.