圆圈加数字的css

方式一

复制代码
.circle {
width: 50px;
height: 50px;
border-radius: 50%;
background-color: #f00;
color: #fff;
text-align: center;
line-height: 50px;
}
.circle::before {
content: attr(data-number);
display: block;
}
<div class="circle" data-number="1"></div>
<div class="circle" data-number="2"></div>
<div class="circle" data-number="3"></div>

方式二

复制代码
.circle {
width: 50px;
height: 50px;
border-radius: 50%;
background-color: #f00;
color: #fff;
text-align: center;
line-height: 50px;
}
.circle::before {
content: "1";
display: block;
}

下面是使用案例

复制代码
<div class="green_list flex_align" v-for="(item,index) in StepReviewLogs.logs"
                                :key="item.id">
                                <div class="flex_align">
                                  <div class="circle" :data-number="index+1"></div> {{item.remark}}: {{item.userName}}
                                </div>
                              </div>

 .circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    /* background-color: #67C23A; */
    border: 1px solid #67C23A;
    color: #67C23A;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0px 3px;
    font-size: 12px;
  }

  .circle::before {
    content: attr(data-number);
    display: block;
    margin-left: 1px;
  }
  .green_list {
    color: rgba(103, 194, 58, 1);

  }
  .flex_align {
    display: flex;

    align-items: center;

  }
相关推荐
渣哥8 分钟前
代理选错,性能和功能全翻车!Spring AOP 的默认技术别再搞混
javascript·后端·面试
遇见火星12 分钟前
Docker入门:快速部署你的第一个Web应用
前端·docker·容器
WeilinerL30 分钟前
泛前端代码覆盖率探索之路
前端·javascript·测试
浮游本尊33 分钟前
React 18.x 学习计划 - 第五天:React状态管理
前端·学习·react.js
-睡到自然醒~38 分钟前
[go 面试] 前端请求到后端API的中间件流程解析
前端·中间件·面试
洛卡卡了1 小时前
Sentry 都不想接,这锅还让我背?这xx工作我不要了!
前端·架构
咖啡の猫1 小时前
Vue 实例生命周期
前端·vue.js·okhttp
JNU freshman1 小时前
vue 之 import 的语法
前端·javascript·vue.js
剑亦未配妥1 小时前
Vue 2 响应式系统常见问题与解决方案(包含_demo以下划线开头命名的变量导致响应式丢失问题)
前端·javascript·vue.js
爱吃的强哥1 小时前
Vue2 封装二维码弹窗组件
javascript·vue.js