①画圆
首先容器设置成正方形,然后border-radius等于一半的边框
②圆角矩形边框
将border-radius设置成height的一半,可以实现好看的圆角矩形边框
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.rec {
width: 200px;
height: 200px;
border-radius: 50%;
background-color: pink;
text-align: center;
line-height: 200px;
}
.rec1 {
width: 200px;
height: 50px;
border-radius: 25px;
background-color: #eee;
text-align: center;
line-height: 50px;
margin-top: 25px;
}
</style>
</head>
<body>
<div class="rec">
实现圆
</div>
<div class="rec1">
好看的圆角矩形
</div>
</body>
</html>