体会CSS3 perspective属性的作用

47 阅读1分钟

体会CSS3 perspective属性的作用

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>体会perspective</title>
<style>
    *{margin:0;padding:0;}
    img{display:block;
        transition: all 2s;
        transform-origin: bottom;
    }
    div{
        width:500px;height:300px;border:1px solid red;margin:100px auto 0;
        perspective: 500px;
        perspective-origin: 400px 500px;
    }
    div:hover img{transform: rotateX( 90deg );}
</style>
</head>
<body style="background:#000;">
    <div>
        <img src="https://www.baidu.com/img/bd_logo1.png" alt="">
    </div>
</body>
</html>

体会CSS3 perspective属性的作用