CSS布局、定位与动画(旋转太极实现)

CSS布局和定位

div默认占整行

float浮起来排列(设定左或右边界)

子元素绝对定位

 position: absolute;

1.初始位置在左上

2.通过left和top控制x、y轴

父元素相对定位

position: relative;

z-index   覆盖优先级

border-radiu边框弯曲程度  solid black 设定黑色

1个值定义4边

2值定义对角

4值按顺时针定义   

动画集成属性

设定名

运动时间

延迟

次数 (infinite无限次)

运动轨迹:线性

移动路线:往返

行进模式:前进

动画表头声明 设置路径

旋转太极实现代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>旋转太极</title>
    <style>
        .fu{
            width:500px;
            height:500px;
            border:1px solid black;
            background-color:gainsboro;
            animation: taiji 2s linear infinite ;

        }/*定义父类class*/
        .fu>div{
            position: absolute;

        }/*子代选择器*/

        .z1{
            width: 250px;
            height: 500px;
            background-color: black;
            border-radius: 250px 0px 0px 250px;
        }
        .z2{
            width: 250px;
            height: 500px;
            background-color:white;
            border-radius: 0px 250px 250px 0px;
            left:250px;
        }
        .z3{
            width:250px;
            height:250px;
            background: white;
            border-radius: 50%;
            z-index: 1;
            left: 125px;
        }
        .z4{
            width:250px;
            height:250px;
            background: black;
            border-radius: 50%;
            z-index: 1;
            left: 125px;
            top: 250px;
        }
        .z5{
            width:90px;
            height:90px;
            background: black;
            border-radius: 50%;
            z-index: 1;
            left:200px;
            top: 80px;
        }
        .z6{
            width:90px;
            height:90px;
            background: white;
            border-radius: 50%;
            z-index: 1;
            left:200px;
            top: 350px;
        }
        @keyframes taiji {
            from {
                transform: rotate(0deg);
            }
            to {
                transform: rotate(360deg);
            }
        }/*动画声明*/
    </style>
</head>
<body>

<div class="fu">
    <div class="z1"></div>
    <div class="z2"></div>
    <div class="z3"></div>
    <div class="z4"></div>
    <div class="z5"></div>
    <div class="z6"></div>

</div>

</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值