DEF 요소에 CSS3 perspective가 있습니다. DIV는 두 개의 하위 DIV를 포함하며, 이들 중 하나는 z 축의 변환을가집니다. 이것은 하나의 DIV가 다른 DIV 앞에 오도록해야하므로 뒤에있는 DIV는보기에서 차단되어야합니다.
그러나 이러한 DIV의 가시성은 CSS3 관점에서 자동으로 처리되는 대신 HTML에 나타나는 순서에 따라 제어되는 것처럼 보입니다.
아래 코드에서 # div3은 z 축에서 # div2 뒤에 있지만 HTML에서 뒤 따르기 때문에 앞에 표시됩니다.
z-index
속성을 사용하여 어떤 DIV가 앞에 있어야하는지 명시 적으로 알 수 있지만 다시 자동화 된 방법을 찾고 있습니다.CSS3 perspective z 축 가시성
<html>
<head>
<style type="text/css">
#div1
{
position: relative;
height: 150px;
width: 200px;
-moz-perspective:150px;
-webkit-perspective:150px;
}
.child
{
padding:50px;
position: absolute;
}
#div2
{
background-color: red;
}
#div3
{
background-color: green;
-moz-transform: translateZ(-50px);
-webkit-transform: translateZ(-50px);
}
</style>
</head>
<body>
<div id="div1">
<div id="div2" class="child">HELLO</div>
<div id="div3" class="child">HELLO</div>
</div>
</body>
</html>
참조 :
jsFiddle