原文:https://www.cnblogs.com/zouqin/p/5498495.html
问题: 怎么实现 父元素的背景覆盖子元素的背景呢?
————————————————————————————
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.test1{
width: 100px;
height: 100px;
border: 1px solid green;
background: green;
position: absolute;
z-index: auto;
}
.test2{
width: 100px;
height: 100px;
border: 1px solid black;
background: black;
position: relative;
left: 20px;
top: -20px;
z-index: -1;
}
</style>
</head>
<body>
<div class="test1">
<div class="test2"></div>
</div>
</body>
</html>
父元素不设置z-index 的值时,默认是auto。此时在设置子元素的值为负数

了解一下,同一个“堆叠上下文中,元素的堆叠顺序”??
