方法1
width: 200px;
height: 200px;
border: 100px solid black;
border-top-color: pink;
border-radius: 50%;
方法2
width: 300px;
height: 300px;
background: radial-gradient(transparent 130px, violet 0px);
border-radius: 50%;
方法1实例代码
<!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>Document</title>
<style>
body {
background-color: tomato;
}
div {
width: 200px;
height: 200px;
border: 100px solid black;
border-top-color: pink;
border-radius: 50%;
animation: myani 5s linear infinite;
}
@keyframes myani {
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div></div>
</body>
</html>
方法2实例代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
background-color: #179067;
}
.ring {
width: 300px;
height: 300px;
background: radial-gradient(transparent 130px, violet 0px);
border-radius: 50%;
margin: auto;
animation: myani 2s infinite;
}
@keyframes myani {
0% {
transform: scale(1);
}
50% {
transform: scale(.1);
}
100% {
transform: scale(1);
}
}
</style>
</head>
<body>
<div class="ring"></div>
</body>
</html>