<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS3属性对层叠上下文的影响2</title>
<style type="text/css">
/* 案例二分解*/
.parent1 {
width: 200px;
height: 100px;
background: #168bf5;
opacity: .5;
}
.child1 {
width: 100px;
height: 200px;
background: #32d19c;
position: relative;
z-index: -1;
}
</style>
</head>
<body>
<!-- 案例二分解:opacity -->
<div class="parent1">
parent
<div class="child1">child</div>
</div>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS3属性对层叠上下文的影响3</title>
<style type="text/css">
/* 案例三分解*/
.parent3 {
width: 200px;
height: 100px;
background: #168bf5;
/* transform的值不为none就可以 */
transform: rotate(5deg);
}
.child3 {
width: 100px;
height: 200px;
background: #32d19c;
position: relative;
z-index: -1;
}
</style>
</head>
<body>
<!-- 案例三分解:transform -->
<div class="parent3">
parent
<div class="child3">child</div>
</div>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS3属性对层叠上下文的影响4</title>
<style type="text/css">
/* 案例四分解*/
.parent4 {
width: 200px;
height: 100px;
background: #168bf5;
filter: blur(5px);
}
.child4 {
width: 100px;
height: 200px;
background: #32d19c;
position: relative;
z-index: -1;
}
</style>
</head>
<body>
<!-- 案例四分解:filter -->
<div class="parent4">
parent
<div class="child4">child</div>
</div>
</body>
</html>
