12.旋转的图片

  • 效果图:


    GIF2.gif
  • xxx.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>12.旋转的楚乔.html</title>
    <style>
        div{
            width: 250px;
            height: 170px;
            /*border: 1px solid red;*/
            margin: 300px auto;
            position: relative;
        }
        div img{
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
            transition: all 0.6s;
            transform-origin: top right;  /*以右上角为基点*/
        }
        div:hover img:first-child{
            transform: rotate(60deg);
        }
        div:hover img:nth-child(2){
            transform: rotate(120deg);
        }
        div:hover img:nth-child(3){
            transform: rotate(180deg);
        }
        div:hover img:nth-child(4){
            transform: rotate(240deg);
        }
        div:hover img:nth-child(5){
            transform: rotate(300deg);
        }
        div:hover img:nth-child(6){
            transform: rotate(360deg);
        }
    </style>
</head>
<body>
    <div>
        <img src="images/1.jpg" alt="">
        <img src="images/2.jpg" alt="">
        <img src="images/3.jpg" alt="">
        <img src="images/4.jpg" alt="">
        <img src="images/5.jpg" alt="">
        <img src="images/6.jpg" alt="">
    </div>
</body>
</html>
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容