Skip to content

Instantly share code, notes, and snippets.

@leavlzi
Last active October 24, 2018 01:55
Show Gist options
  • Save leavlzi/6182341 to your computer and use it in GitHub Desktop.
Save leavlzi/6182341 to your computer and use it in GitHub Desktop.
<!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>透明测试</title>
<style>
*{
margin:0;
padding:0;
font-size:12px;
}
body{
text-align:center;
background-color:#e3e3e3;
}
.bg{
margin:0 auto;
width:200px;
height:200px;
background-color:#ccc;
position:relative;
text-align:center
}
.bg .bg_p{
position:absolute;
bottom:0;
left:0;
width:100%;
height:20px;
z-index:20px;
background-color:#fff;
filter:alpha(opacity=30);
opacity:0.3;
}
.bg p{
position:absolute;
bottom:2px;
left:0;
width:100%;
color:#000;
}
</style>
</head>
<body>
<div class="bg">
<div class="bg_p"></div>
<p>这里的背景要透明</p>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment