css3 景深

<!DOCTYPE html>
<html>
<head>
<title>景深</title>
<meta charset="utf-8">
<style type="text/css">
.box{
width: 400px;
height: 400px;
margin: 100px auto;
position: relative;
transform-style: preserve-3d;
/*景深相当于眼睛距离元素的位置距离*/
perspective: 100px;
/*眼睛距元素的偏移位置*/
perspective-origin: 10px 100px;
}
img{
width: 150px;
height: 200px;
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
margin: auto;
transform: rotateX(50deg);
}
</style>
</head>
<body>
<div class="box">
<img src="img/dameizi.jpeg">
</div>
</body>
</html>

posted @ 2017-02-11 11:49  AdiaLike  阅读(3362)  评论(0编辑  收藏  举报