【问题标题】:how to make circle on html div with some text? [closed]如何在 html div 上用一些文字制作圆圈? [关闭]
【发布时间】:2018-07-08 13:45:49
【问题描述】:

如图所示,我想在 div 上画一个圆,我尝试通过使用border-radius 属性来完成它。 并使用位置在div上粘贴一个圆圈,但没有得到完美的结果 请给我建议

【问题讨论】:

  • 您尝试过的代码在哪里...?
  • 请阅读How to Ask。您需要向我们充分解释您需要什么,到目前为止您已经尝试过什么,并向我们展示有问题的代码。

标签: html css


【解决方案1】:

类似的东西?

Jsfiddle

.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>

【讨论】:

  • 谢谢,我试过了,但我想把这个圆圈放在右侧的 div 上
  • 我编辑了我的答案
猜你喜欢
  • 2020-05-06
  • 2017-07-04
  • 2013-05-08
  • 1970-01-01
  • 2022-10-15
  • 2015-05-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多