如何创建具有不同圆环颜色的有序列表

SNT*_*SNT 1 html css

我正在使用有序列表显示结果。现在我想在数字上添加一个圆圈,颜色从绿色变为红色。使用是第一个结果是优先级,其他跟随的较少。所以颜色渐变从绿色变为红色。

.listAddress li {
    padding-top: 15px;
    padding-bottom: 15px;
    display: list-item;
    padding: 10px 10px;
    color: #252424;
    font-size: 12px;
     width: auto;
    font-style: normal;
    text-transform: uppercase;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
Run Code Online (Sandbox Code Playgroud)
<ol class="listAddress">
<li>365 W Northwest Hwy, Palatine, IL 60067, USA</li>
<li>365 W Northwest Hwy, Palatine, IL 60067, USA</li>
<li>365 W Northwest Hwy, Palatine, IL 60067, USA</li>
</ol>
Run Code Online (Sandbox Code Playgroud)

Sti*_*ers 5

看看这是否有帮助。

js小提琴

body { background: white; }
.listAddress {
  padding-left: 0;
  position: relative;
}
.listAddress:before {
  content: "";
  position: absolute;
  z-index: -2;
  left: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(to bottom, green, red);
}
.listAddress li {
  counter-increment: step-counter;
  list-style: none;
  padding-bottom: 20px;
  position: relative;
  padding-left: 25px;
  overflow: hidden;
}
.listAddress li:before {
  content: counter(step-counter);
  margin-right: 5px;
  box-shadow: 0 0 0 100px white;
  color: white;
  border-radius: 50%;
  position: absolute;
  z-index: -1;
  left: 0;
  top: 0;
  text-align: center;
  width: 20px;
  height: 20px;
}
Run Code Online (Sandbox Code Playgroud)
<ol class="listAddress">
  <li>365 W Northwest Hwy, Palatine, IL 60067, USA</li>
  <li>365 W Northwest Hwy, Palatine, IL 60067, USA</li>
  <li>365 W Northwest Hwy, Palatine, IL 60067, USA</li>
  <li>365 W Northwest Hwy, Palatine, IL 60067, USA</li>
  <li>365 W Northwest Hwy, Palatine, IL 60067, USA</li>
</ol>
Run Code Online (Sandbox Code Playgroud)