【发布时间】:2021-03-03 17:04:43
【问题描述】:
高宽都是百分比时如何用CSS画半圆?
.container{
width: 200px;
height: 200px;
background: blue;
display: flex;
}
.semiCircle{
position:relative;
height: 90%;
width: 45%;
border-radius: 90% 0 0 90%;
background: red;
margin:auto;
}
<div class='container'>
<div class='semiCircle'></div>
</div>
【问题讨论】:
-
你的意思是高宽不相等?
-
在边界半径中只需使用
90px 0 0 90px