CSS3 transition过渡,transform2D移动 translate 旋转 rotate 缩放 scalse, animation动画,.transform: translate3d详解

    filter:函数()

<title>Document</title>

    <style>

        img{

            filter: blur(5px);

        }

        img:hover{

            filter: blur(0);

        }

    </style>

</head>

<body>

    <!-- filter csss属性将模糊或颜色便宜等图形效果应用于元素 -->

    <!-- filter:函数()  filter:blur(5px);blur模糊处理 数值越大越模糊 -->

   <img src=".././imgs/bg.gif" alt="">

</body>

</html>

2.   calc() 函数 

<!-- css3 cal函数 -->

    <!-- calc()此css函数让你在声明css属性值执行一些计算 -->

    <!-- 括号里面可以使用+-*/来进行计算 -->

    <style>

        .father{

            width: 300px;

            height: 200px;

            background-color: pink;

        }

        .son{

            width: calc(250 - 30px);

            height: 30px;

            background-color: skyblue;

        }

    </style>

</head>

<body>

    <div class="father">

        <div class="son"></div>

    </div>

</body>

</html>

3.transition过渡

    <title>Document</title>

    <style>

    <!-- 过渡动画:是从一个状态渐渐的过渡到另一个状态,经常和:hover一起用 -->

    <!-- transition:要过渡的属性 花费时间 运动曲线 何时开始 -->

      div{

          width: 200px;

          height: 100px;

          background-color: pink;

          /* transition: width .5s ease 1s; */

          /* transition: height .5s ease 1s; 没变化 */

 

          /* 如果想要写多个属性,利用逗号隔开 */

          transition:width .5s,height .5s ;

 

          /* 如果想要多个属性都变化,属性写all就可以了 */

          /* 谁做过渡给谁加 */

          transition: all .5s;

      }

      div:hover{

          width: 400px;

          height: 500px;

          background-color: lawngreen;

      }

    </style>

</head>

<body>

   <div></div>

</body>

</html>

案列:transition 进度条

    <title>Document</title>

    <style>

        .bar{

            width: 150px;

            height: 15px;

            border: 1px solid red;

            border-radius:7px ;

            padding: 1px;

            transition: all 10s;

        }

        .bar_in{

            width: 50%;

            height: 100%;

            background-color: red;

        }

        .bar:hover .bar_in{

            width: 100%;

        }

    </style>

</head>

<body>

    <div class="bar">

        <div class="bar_in"></div>

    </div>

</body>

</html>

 

4.    transform: translate()位移

    <title>Document</title>

    <style>

    <!-- 实现元素的位移,旋转,缩放等效果 -->

    <!-- 移动 translate 旋转 rotate 缩放 scalse -->

<!-- 移动盒子的位置:定位 盒子的外边距  2d的转换移动 -->

        div{

            width: 200px;

            height: 200px;

            background-color: pink;

            /* x就是x轴上移动位置,y轴就是y轴上移动位置,中间用逗号隔开 */

            transform: translate(x,y);

            transform: translate(100px,100px);

            /* 只移动x轴 */

            transform: translate(100px);

        }

    </style>

</head>

<body>

<div></div>

</body>

</html>

案列:让盒子水平居中

    <title>Document</title>

    <style>

        div{

            position: relative;

            width: 400px;

            height: 400px;

            /* 我们tansform里面的参数可以用%

            如果里面的参数据哦%移动的距离是盒子自身的宽度或则高度来对比的

            这里的50%就是50px,因为盒子的宽度是100px */

            background-color: pink;

            /* transform: translateX(50%); */

        }

        p{

            position: absolute;

            top:50%;

            left: 50%;

            width: 200px;

            height: 200px;</

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值