【发布时间】:2018-07-08 13:45:49
【问题描述】:
如图所示,我想在 div 上画一个圆,我尝试通过使用border-radius 属性来完成它。 并使用位置在div上粘贴一个圆圈,但没有得到完美的结果 请给我建议
【问题讨论】:
-
您尝试过的代码在哪里...?
-
请阅读How to Ask。您需要向我们充分解释您需要什么,到目前为止您已经尝试过什么,并向我们展示有问题的代码。
如图所示,我想在 div 上画一个圆,我尝试通过使用border-radius 属性来完成它。 并使用位置在div上粘贴一个圆圈,但没有得到完美的结果 请给我建议
【问题讨论】:
类似的东西?
.box{
width: 200px;
height: 100px;
border: 5px solid #666;
margin: 50px;
position: relative;
}
.circle{
width: 80px;
height: 80px;
border-radius: 50%;
background-color: red;
display: flex;
align-items: center;
justify-content: center;
font-family: sans-serif;
color: #fff;
position: absolute;
right: -40px;
top: -40px;
}
p{
font-weight: bold;
display:flex;
flex-direction: column;
font-weight: bold;
font-size: 30px;
text-align: center;
}
p span{
font-weight: normal;
font-size: .5em
}
<div class="box">
<div class="circle">
<p>20%<span>OFF</span></p>
</div>
</div>
【讨论】: