我希望我的孩子div在父div之后。我使用过z-index: -1
。它适用于IE8标准模式,但在Quirks模式下,子div显示在父div之上。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style type="text/css">
.first{
width: 400px;
height: 300px;
background-color: blue;
position:absolute;
}
.second{
width: 600px;
height: 300px;
z-index: -1;
background-color: red;
position:absolute;
}
</style>
</head>
<body>
<div class="first">
I am parent div
<div class="second">
I am child div
</div>
</div>
</body>
</html>