当前位置:首页>站长学院>建站知识

CSS3动画(360度旋转、旋转放大、放大、移动)

来源:本站 发布时间:2023-06-28热度:37 ℃

CSS3动画(360度旋转、旋转放大、放大、移动),复制保存到本地即可测试,自取。

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Title</title>

    <style type="text/css">

        div{

            width:120px;

            height:120px;

            line-height:120px;

            margin: 20px;

            background-color: #5cb85c;

            float: left;

            font-size: 12px;

            text-align: center;

            color:orangered;

        }

        /*效果一:360°旋转 修改rotate(旋转度数)*/

        .img1 {

            transition: All 0.4s ease-in-out;

            -webkit-transition: All 0.4s ease-in-out;

            -moz-transition: All 0.4s ease-in-out;

            -o-transition: All 0.4s ease-in-out;

        }


        .img1:hover {

            transform: rotate(360deg);

            -webkit-transform: rotate(360deg);

            -moz-transform: rotate(360deg);

            -o-transform: rotate(360deg);

            -ms-transform: rotate(360deg);

        }


        /*效果二:放大 修改scale(放大的值)*/

        .img2 {

            transition: All 0.4s ease-in-out;

            -webkit-transition: All 0.4s ease-in-out;

            -moz-transition: All 0.4s ease-in-out;

            -o-transition: All 0.4s ease-in-out;

        }


        .img2:hover {

            transform: scale(1.2);

            -webkit-transform: scale(1.2);

            -moz-transform: scale(1.2);

            -o-transform: scale(1.2);

            -ms-transform: scale(1.2);

        }

       /*效果三:旋转放大 修改rotate(旋转度数) scale(放大值)*/

        .img3 {

            transition: All 0.4s ease-in-out;

            -webkit-transition: All 0.4s ease-in-out;

            -moz-transition: All 0.4s ease-in-out;

            -o-transition: All 0.4s ease-in-out;

        }


        .img3:hover {

            transform: rotate(360deg) scale(1.2);

            -webkit-transform: rotate(360deg) scale(1.2);

            -moz-transform: rotate(360deg) scale(1.2);

            -o-transform: rotate(360deg) scale(1.2);

            -ms-transform: rotate(360deg) scale(1.2);

        }

        /*效果四:上下左右移动 修改translate(x轴,y轴)*/

        .img4 {

            transition: All 0.4s ease-in-out;

            -webkit-transition: All 0.4s ease-in-out;

            -moz-transition: All 0.4s ease-in-out;

            -o-transition: All 0.4s ease-in-out;

        }


        .img4:hover {

            transform: translate(0, -10px);

            -webkit-transform: translate(0, -10px);

            -moz-transform: translate(0, -10px);

            -o-transform: translate(0, -10px);

            -ms-transform: translate(0, -10px);

        }

    </style>

</head>

<body>

<div>效果一:360°旋转 </div>

<div>效果二:放大</div>

<div>效果三:旋转放大</div>

<div>效果四:上下左右移动 </div>


</body>

</html>


转载请注明来源网址:https://www.abcmuban.com/wangzhan/470.html

如果你的问题还没有解决,点击PBootCMS建站交流群加入交流群一起学习交流。支持与鼓励站长,请扫码赞赏

  • 微信支付

    微信扫一扫

  • 支付宝支付

    支付宝扫一扫

相关阅读
交流学习

加入VIP即可下载全部模板;2天更新1套模板

年VIP:199元(金牌)

终身VIP:299元(钻石)

  • QQ号

    Q:2935517386

  • 添加微信客服

    微信客服

  • QQ号

    Q群:817597747

热门标签
 
Q:2935517386