<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS实现网页背景半透明</title>
<style type="text/css">
body{
margin:0;
padding:0;
}
.backgroundImg{
/*设置背景图片*/
background:url(image/test.png) no-repeat;
width:230px;
height:136px;
padding:10px;
border:1px solid red;
}
.opacity{
/*设置半透明*/
background:#000;
width:120px;
height:100px;
color:#fff;
/*IE中设置半透明*/
filter:alpha(opacity=60);
/*支持Firefox, Safari, Chrome*/
opacity: 0.6;
}
</style>
</head>
<body>
<!--背景图片-->
<div class="backgroundImg">
<div class="opacity">
DIV半透明演示。
</div>
</div>
</body>
</html>
01-diiv透明度设置
最新推荐文章于 2021-06-27 11:36:27 发布