Progress bar made of solid line, with dots as steps

后端 未结 6 1767
[愿得一人]
[愿得一人] 2020-12-01 22:04

I\'m trying to create a vertical progress-bar, with 8 dots on a solid line (with the 8th on the end), where every dot stands for one step in the process. See attached screen

6条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-01 22:23

    CSS

    My CSS solution is based around multiple div's which allow you to have as many as you like and determine how many are completed.

    .complete {
      width: 5px;
      height: 50px;
      position: relative;
      background: green;
      margin-left: 8px;
    }
    .complete:after {
      content: '';
      width: 20px;
      height: 20px;
      border-radius: 50%;
      position: absolute;
      bottom: -7.5px;
      left: -8px;
      background: green;
      z-index: 100;
    }
    .not_complete {
      width: 5px;
      height: 50px;
      background: lightgreen;
      position: relative;
      margin-left: 8px;
    }
    .not_complete:after {
      content: '';
      width: 20px;
      height: 20px;
      border-radius: 50%;
      position: absolute;
      bottom: -7.5px;
      left: -8px;
      background: lightgreen;
      z-index: 100;
    }

    SVG

    This is also possible using a SVG g element and using it with different fills.

    Just remember that the height of the SVG needs to be the same or greater than all the elements put together.

    
      
        
          
          
        
        
          
          
        
      
    
      
      
      
      
      
      
      
      
    

提交回复
热议问题