css画太极
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>css画太极</title>
<style>
body{
background-color: grey;
}
#yinyang{
width: 300px;
height: 300px;
border-radius: 50%;
background-color: #fff;
position: relative;
left:calc(50% - 150px); /* calc 操作符的两边必须有空间*/
background: linear-gradient(to bottom, #ffffff 0%,#ffffff 50%,#000000 50%,#000000 100%);
}
#yin{
width:50%;
height: 50%;
background-color: #000000;
border-radius: 50%;
position: absolute;
top:25%;
}
#yang{
width:50%;
height: 50%;
background-color: #ffffff;
border-radius: 50%;
position: absolute;
top:25%;
right: 0;
}
.yangpoint{
background-color:#ffffff;
width:20%;
height: 20%;
border-radius:50%;
position: absolute;
left:40%;
top:40%; /* 50%-20%/2*/
}
.yinpoint{
background-color:#000000;
width:20%;
height: 20%;
border-radius:50%;
position: absolute;
left:40%;
top:40%;
}
</style>
</head>
<body>
<div id="yinyang">
<div id="yin">
<div class="yangpoint"></div>
</div>
<div id="yang">
<div class="yinpoint"></div>
</div>
</div>
</body>
</html>
posted on 2019-05-18 16:00 ShawSpring 阅读(208) 评论(0) 编辑 收藏 举报