边框-绘制八卦图
程序员文章站
2022-03-11 09:37:04
...
效果
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.box {
position: relative;
width: 400px;
height: 400px;
border: 1px solid #000;
margin: 100px auto;
background-color: #eee;
}
.left {
float: left;
width: 200px;
height: 400px;
background-color: rgb(255, 255, 255);
border-radius: 200px 0 0 200px;
}
.right {
float: left;
width: 200px;
height: 400px;
background-color: rgb(0, 0, 0);
border-radius: 0 200px 200px 0;
}
.top {
position: absolute;
left: 100px;
top: 0;
width: 200px;
height: 200px;
box-sizing: border-box;
border-radius: 50%;
border: 70px solid #000;
background-color: #fff;
}
.bottom {
position: absolute;
left: 100px;
bottom: 0;
width: 200px;
height: 200px;
box-sizing: border-box;
border: 70px solid #fff;
background-color: #000;
border-radius: 50%;
}
</style>
</head>
<body>
<div class="box">
<div class="left"></div>
<div class="right"></div>
<div class="top"></div>
<div class="bottom"></div>
</div>
</body>
</html>