如何制作自定义步进器?

时间:2019-05-28 12:27:24

标签: javascript html css3

我想使步进器具有两个与另一个圆圈链接的圆圈(一个圆圈在另一个圆圈内),但是很难在另一个圆圈内做到,我可以吗?

我尝试使用此https://jsfiddle.net/dedi_wibisono17/c69e374r/2/并将其更改为我想要的样子,但是我失败了!

<div class="row">
  <div class="col-xs-12 col-md-8 offset-md-2 block border">
    <div class="wrapper-progressBar">
      <ul class="progressBar">
        <li class="active">Beong Processed</li>
        <li class="active">Waiting for payment</li>
        <li>Paid</li>
      </ul>
    </div>
  </div>
</div>


.wrapper-progressBar {
    width: 100%
}

.progressBar {
}

.progressBar li {
    list-style-type: none;
    float: left;
    width: 33%;
    position: relative;
    text-align: center;
}

.progressBar li:before {
    content: " ";
    line-height: 30px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    display: block;
    text-align: center;
    margin: 0 auto 10px;
    background-color: white
}

.progressBar li:after {
    content: "";
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: #ddd;
    top: 15px;
    left: -50%;
    z-index: -1;
}

.progressBar li:first-child:after {
    content: none;
}

.progressBar li.active {
    color: dodgerblue;
}

.progressBar li.active:before {
    border-color: dodgerblue;
    background-color: dodgerblue
}

.progressBar li.active + li:after {
    background-color: dodgerblue;
}

出现错误,z-index = -1的链接线停留在节背景的后面,我如何将其放在前面(我尝试更改z-index但它看起来不太好,它停留在圆圈)

1 个答案:

答案 0 :(得分:0)

这应该使您更接近要做什么。

.wrapper-progressBar {
    width: 100%;
}

.progressBar {
}

.progressBar li {
    list-style-type: none;
    float: left;
    width: 33%;
    position: relative;
    text-align: center;
    color:white
}

.progressBar li:before {
    content: " ";
    line-height: 30px;
    border-radius: 50%;
    width: 10px;
    height: 10px;       
    display: block;
    text-align: center;
    padding:5px;
    margin: 15px auto 25px;
    background-color: white;

}

.progressBar li:after {
    content: "";
    position: absolute;
    width: 94%;
    height: 2px;
    background-color: #19C1D5;
    top: 18px;
    left: -47%;   
}

.progressBar li:first-child:after {
    content: none;
}

.progressBar li.active:before {
  margin:0 auto 10px;
  border:15px solid #19C1D5;
}   

主要更改是更改了li:before的边距,使其充当顶部和底部的透明边框,并更改了li.active:before以还原边距/添加了边框。