CSS3制作太极图

CSS3制作太极图

 

<style>

.box{

width: 400px;

height: 400px;

border: 1px solid black;

margin: 80px auto 0;

border-radius: 50%;

box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);

position: relative;

animation: mymove 2s linear infinite;

}

.box:before{

content: "";

width: 200px;

height: 400px;

background-color: black;

position: absolute;

top: 0;

left: 0;

border-top-left-radius: 200px;

border-bottom-left-radius: 200px;

}

.box:after{

content: "";

width: 200px;

height: 400px;

background-color: white;

position: absolute;

top: 0;

left: 200px;

border-top-right-radius: 200px;

border-bottom-right-radius: 200px;

}

.circle1{

width: 200px;

height: 200px;

background-color: black;

border-radius: 300px;

position: absolute;

top: 0;

left: 100px;

z-index: 2;

}

.circle2{

width: 200px;

height: 200px;

background-color: white;

border-radius: 300px;

position: absolute;

top: 200px;

left: 100px;

z-index: 2;

}

.circle1:after{

content: "";

width: 75px;

height: 75px;

background-color: white;

border-radius: 75px;

position: absolute;

top: 60px;

left: 55px;

z-index: 3;

}

.circle2:after{

content: "";

width: 75px;

height: 75px;

background-color: black;

border-radius: 75px;

position: absolute;

top: 60px;

left: 55px;

z-index: 3;

}

@keyframes mymove{

from{

transform: rotate(0deg);

}

to{

transform: rotate(360deg);

}

}

</style>

</head>

<body>

<div class="box">

<div class="circle1"></div>

<div class="circle2"></div>

</div>

</body>

在盒子里面绘制上下两个小圆,这两个小圆的特点,都是绝对定位在外层盒子上的某个点上。

利用伪类before绘制 两个圆,将这两个对象定位在 外层盒子的某个点上。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值