css opacity property


  Translation results:

UK [əʊˈpæsəti] US [oʊˈpæsəti]

n.Opacity; puzzling; difficult to understand; vague

Plural: opacities

css opacity propertysyntax

Function:Set the opacity level of the element.

Syntax: opacity: value|inherit;

Description: value Specifies opacity. From 0.0 (fully transparent) to 1.0 (fully opaque). inherit should inherit the value of the opacity attribute from the parent element.​

Note: IE8 and earlier versions support alternative filter attributes. For example: filter:Alpha(opacity=50).

css opacity propertyexample

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
background-color:red;
opacity:0.5;
filter:Alpha(opacity=50); /* IE8 以及更早的浏览器 */
}
</style>
</head>
<body>

<div>本元素的不透明度是 0.5。请注意,文本和背景色都受到不透明级别的影响。</div>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A