我想部分地为圆圈边框着色。这意味着我需要配置前景和背景的颜色。
答案 0 :(得分:0)
你可以这样做。我逆时针使用了33%和67%的切片。
<强> HTML:强>
<div class="div div-p">
<div class="div-c"></div>
<div class="div div-1">
<div class="div div-2"></div>
</div>
<div class="div div-3">
<div class="div div-4"></div>
</div>
</div>
<强> CSS:强>
.div-p {
background-color: #e5e5e5;
position: relative;
margin: 100px;
}
.div-c {
background: white;
position: absolute;
z-index: 999;
width: 80px;
height: 80px;
top: 10px;
left: 10px;
border-radius: 50%;
}
.div {
position: absolute;
top: 0px;
left: 0px;
width: 100px;
height: 100px;
border-top-left-radius: 100px;
border-top-right-radius: 100px;
border-bottom-right-radius: 100px;
border-bottom-left-radius: 100px;
}
.div-1 {
position: absolute;
clip: rect(0px 100px 100px 0px);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
.div-2 {
position: absolute;
clip: rect(0px 50px 100px 0px);
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
background-color: #009999;
}
.div-3 {
position: absolute;
clip: rect(0px 100px 100px 50px);
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
}
.div-4 {
position: absolute;
clip: rect(0px 50px 100px 0px);
-webkit-transform: rotate(61.2deg);
transform: rotate(61.2deg);
background-color: #009999;
}
答案 1 :(得分:0)
您可以使用linear-gradient - CSS | MDN
MARKUP:
<div></div>
<div></div>
型:
div {
width: 150px;
height:150px;
display: block;
border-radius: 50%;
background-color: #EC5F51;
border: 2px solid #EC5F51;
margin: 50px auto;
position:relative;
}
div:before{
content: "";
position: absolute;
width: 114px;
height: 114px;
background: white;
z-index: 1;
border-radius: 50%;
left: 18px;
top: 18px;
}
div:nth-child(1) {
background-image:
linear-gradient(126deg, transparent 50%, #ccc 50%),
linear-gradient(90deg, #ccc 50%, transparent 50%);
}
div:nth-child(2) {
background-image:
linear-gradient(180deg, transparent 50%, #ccc 50%),
linear-gradient(90deg, #ccc 50%, transparent 50%);
}