css3 opacity property


  Translation results:

opacity

英[əʊˈpæsəti] 美[oʊˈpæsəti]

n.Opacity; puzzling; difficult to understand; vague

Plural: opacities

css3 opacity propertysyntax

Function:Retrieve or set the opacity of the object.

Note: For IE browsers that do not yet support the opacity attribute, you can use IE's private filter attribute to achieve the same effect as opacity

css3 opacity propertyexample

<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8" />
<title></title>
<style>
h1 {
	margin: 10px 0;
	font-size: 16px;
}
.test,
.test2 {
	width: 300px;
	height: 150px;
	padding: 10px;
}
.test {
	background:#050;
}
.test2 {
	margin: -120px 0 0 50px;
	background: #000;
	filter: alpha(opacity=50);
	opacity: .5;
	color: #fff;
}
</style>
</head>
<body>
<h1>下例是一个半透明的效果:</h1>
<div class="test">不透明度为100%的box</div>
<div class="test2">不透明度为50%的box</div>
</body>
</html>

Run instance »

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

Home

Videos

Q&A