Step progressbar - html

I'm trying to complete a step progress bar, and on the final node the complete color is not reaching to the end, the finalized color is not being applied:
#charset "UTF-8";
.container {
width: 100%;
}
.multi-steps > li.is-active ~ li:before, .multi-steps > li.is-active:before {
content: counter(stepNum);
font-family: inherit;
font-weight: 700;
}
.multi-steps > li.is-active ~ li:after, .multi-steps > li.is-active:after {
background-color: #ededed;
}
.multi-steps {
margin: 0;
border-top: 1px solid red;
display: flex;
padding: 0;
}
.multi-steps > li {
flex: 1;
position: relative;
text-align: center;
display: flex;
counter-increment: stepNum;
flex-direction: column;
align-items: flex-start;
color: tomato;
}
.multi-steps > li:before {
content: "ο€Œ";
content: "βœ“;";
content: "𐀃";
content: "𐀄";
content: "βœ“";
width: 36px;
height: 36px;
line-height: 32px;
display: block;
/*margin: 0 auto 4px;*/
background-color: #fff;
text-align: center;
font-weight: bold;
border-width: 2px;
border-style: solid;
border-color: tomato;
border-radius: 50%;
}
.multi-steps > li:after {
content: "";
position: absolute;
height: 2px;
width: 100%;
background-color: tomato;
top: 16px;
left: 0;
right: 0;
z-index: -1;
}
.multi-steps > li:last-child {
/*&:after{*/
flex-grow: 0;
align-items: flex-end;
white-space: nowrap;
/*display: none;*/
/*}*/
}
.multi-steps > li.is-active:before {
background-color: #fff;
border-color: tomato;
}
.multi-steps > li.is-active ~ li {
color: #808080;
}
.multi-steps > li.is-active ~ li:before {
background-color: #ededed;
border-color: #ededed;
}
<div class="container">
<br /><br />
<ul class="list-unstyled multi-steps">
<li>
<div>Start</div>
</li>
<li>
<div>Should be aligned center</div>
</li>
<li>
<div>Should be centered too</div>
</li>
<li class="is-active">
<div>Finish step belevie or not</div>
</li>
</ul>
</div>
on this code I should center the titles of bot nodes and also the "completed" color should reach until the last node. For more detail please refer to my sniped code with sass

The problem is in your line:
.multi-steps > li.is-active ~ li:after, .multi-steps > li.is-active:after {
background-color: #ededed;
}
Which overrides the colour. Simply removing this will add the colour back in:
#charset "UTF-8";
.container {
width: 100%;
}
.multi-steps > li.is-active ~ li:before, .multi-steps > li.is-active:before {
content: counter(stepNum);
font-family: inherit;
font-weight: 700;
}
.multi-steps {
margin: 0;
border-top: 1px solid red;
display: flex;
padding: 0;
}
.multi-steps > li {
flex: 1;
position: relative;
text-align: center;
display: flex;
counter-increment: stepNum;
flex-direction: column;
align-items: flex-start;
color: tomato;
}
.multi-steps > li:before {
content: "ο€Œ";
content: "βœ“;";
content: "𐀃";
content: "𐀄";
content: "βœ“";
width: 36px;
height: 36px;
line-height: 32px;
display: block;
/*margin: 0 auto 4px;*/
background-color: #fff;
text-align: center;
font-weight: bold;
border-width: 2px;
border-style: solid;
border-color: tomato;
border-radius: 50%;
}
.multi-steps > li:after {
content: "";
position: absolute;
height: 2px;
width: 100%;
background-color: tomato;
top: 16px;
left: 0;
right: 0;
z-index: -1;
}
.multi-steps > li:last-child {
/*&:after{*/
flex-grow: 0;
align-items: flex-end;
white-space: nowrap;
/*display: none;*/
/*}*/
}
.multi-steps > li.is-active:before {
background-color: #fff;
border-color: tomato;
}
.multi-steps > li.is-active ~ li {
color: #808080;
}
.multi-steps > li.is-active ~ li:before {
background-color: #ededed;
border-color: #ededed;
}
<div class="container">
<br /><br />
<ul class="list-unstyled multi-steps">
<li>
<div>Start</div>
</li>
<li>
<div>Should be aligned center</div>
</li>
<li>
<div>Should be centered too</div>
</li>
<li class="is-active">
<div>Finish step belevie or not</div>
</li>
</ul>
</div>

Related

Responsive Progress Bar Vertical Alignment

I have a responsive multi step progress bar, link here and code snippet below;
.multi-steps > li.is-active:before, .multi-steps > li.is-active ~ li:before {
content: counter(stepNum);
font-family: inherit;
font-weight: 700;
}
.multi-steps > li.is-active:after, .multi-steps > li.is-active ~ li:after {
background-color: #ededed;
}
.multi-steps {
display: table;
table-layout: fixed;
width: 100%;
}
.multi-steps > li {
counter-increment: stepNum;
text-align: center;
display: table-cell;
position: relative;
color: tomato;
}
.multi-steps > li:before {
content: '\f00c';
content: '\2713;';
content: '\10003';
content: '\10004';
content: '\2713';
display: block;
margin: 0 auto 4px;
background-color: #fff;
width: 36px;
height: 36px;
line-height: 32px;
text-align: center;
font-weight: bold;
border-width: 2px;
border-style: solid;
border-color: tomato;
border-radius: 50%;
}
.multi-steps > li:after {
content: '';
height: 2px;
width: 100%;
background-color: tomato;
position: absolute;
top: 16px;
left: 50%;
z-index: -1;
}
.multi-steps > li:last-child:after {
display: none;
}
.multi-steps > li.is-active:before {
background-color: #fff;
border-color: tomato;
}
.multi-steps > li.is-active ~ li {
color: #808080;
}
.multi-steps > li.is-active ~ li:before {
background-color: #ededed;
border-color: #ededed;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<br /><br />
<ul class="list-unstyled multi-steps">
<li>Start</li>
<li class="is-active">First Step</li>
<li>Middle Stage</li>
<li>Finish</li>
</ul>
</div>
This works fine but on smaller screens (e.g max-device-width: 480px), portrait mode i'd like to stack the steps vertically.
How can I achieve this?
Inside your media query, change display: table-cell to display: block on the .multi-steps > li element. That should get you close to what you want to achieve. You'll also need to apply some additional styling just to neat it out. Hope that helps.
e.g.
.multi-steps > li {
display: block;
}
Add a <span> element arounf the text, the use this CSS
.multi-steps > li {
display: block;
position: relative;
padding-bottom: 45px;
}
.multi-steps > li:before {
content: '\f00c';
content: '\2713;';
content: '\10003';
content: '\10004';
content: '\2713';
display: block;
margin: 0 auto 4px;
background-color: #fff;
width: 36px;
height: 36px;
line-height: 32px;
text-align: center;
font-weight: bold;
border-width: 2px;
border-style: solid;
border-color: tomato;
border-radius: 50%;
}
.multi-steps > li:after {
content: '';
height: 2px;
width: 100%;
background-color: tomato;
position: absolute;
left: 50%;
z-index: -1;
display: inline-block;
top: 0;
left: 50%;
width: 3px;
height: 105px;
}
.multi-steps > li span.step {
margin-left: 50px;
position: relative;
top: 20px;
}

Tab menu with border

Currently i have menu like this:
But I need to add a fill for the selected menu item and the same for home menu item, like next:
My code is:
<head>
<meta charset="UTF-8">
<title>Tab</title>
<style>
.tabs {
list-style-type: none;
position: relative;
}
.tabs:after {
content: "";
clear: both;
display: block;
}
.tabs li {
float: left;
}
.tabs li>input {
display: none;
}
.tabs li>label {
display: inline-block;
padding: 8px 30px;
}
.tabs .tab-content {
display: none;
position: absolute;
width: 100vw;
left: 0;
}
.tabs li>input:checked~.tab-content {
display: block;
}
ul {
background: rgb(65, 63, 63);
color: white;
}
.home {
background-color: blue;
}
.order {
background-color: green;
}
.tab-content {
padding: 5px;
border-top: 2px solid white;
}
</style>
</head>
<body>
<ul class="tabs">
<li>
<input type="radio" name="tabs" id="tab-1" checked>
<label for="tab-1" class="home">Home</label>
<div class="tab-content home"></div>
</li>
<li>
<input type="radio" name="tabs" id="tab-2">
<label for="tab-2" class="order">Order</label>
<div class="tab-content order"></div>
</li>
</ul>
</body>
How i can add fill for selected menu item? Or maybe I need to somehow break the border and increase the height of the selected menu item?
A solution could be to use a pseudo-element after in your label tag:
.tabs label:after {
content: "";
display: none;
background-color: inherit;
position: absolute;
z-index: 10;
left: 0;
bottom: -2px;
height: 2px;
width: 100%;
}
.tabs li>input:checked+label:after {
display: block;
}
.tabs {
list-style-type: none;
position: relative;
}
.tabs:after {
content: "";
clear: both;
display: block;
}
.tabs li {
float: left;
}
.tabs li>input {
display: none;
}
.tabs li>label {
display: inline-block;
padding: 8px 30px;
position: relative;
}
.tabs .tab-content {
display: none;
position: absolute;
width: 100vw;
left: 0;
}
.tabs li>input:checked~.tab-content {
display: block;
}
ul {
background: rgb(65, 63, 63);
color: white;
}
.home {
background-color: blue;
}
.order {
background-color: green;
}
.tab-content {
padding: 5px;
border-top: 2px solid white;
}
.tabs li>input:checked+label:after {
display: block;
}
.tabs label:after {
content: "";
display: none;
background-color: inherit;
position: absolute;
z-index: 10;
left: 0;
bottom: -2px;
height: 2px;
width: 100%;
}
<ul class="tabs">
<li>
<input type="radio" name="tabs" id="tab-1" checked>
<label for="tab-1" class="home">Home</label>
<div class="tab-content home"></div>
</li>
<li>
<input type="radio" name="tabs" id="tab-2">
<label for="tab-2" class="order">Order</label>
<div class="tab-content order"></div>
</li>
</ul>
Here's full working code:
document.querySelectorAll('.tabbar .tabs>li').forEach(function (c){
c.addEventListener('click', function(){
for (var elem of c.parentElement.children) {
elem.classList.remove('active');
document.querySelector(elem.getAttribute('page'))
.classList.remove('active');
}
document.querySelector(c.getAttribute('page')).classList.add('active');
c.classList.add('active');
});
});
body {
font-family: sans-serif;
}
.tabbar .tabs {
list-style: none;
display: flex;
flex-direction: row;
background: #aaa;
margin: 0 0 2px 0;
padding: 0;
}
.tabbar .pages {
list-style: none;
display: block;
padding: 0;
margin: 0;
color: #fff;
}
.tabbar .pages>li {
padding: 15px;
display: none;
}
.tabbar .pages>li.active {
display: block;
}
.tabbar .tabs>li {
padding: 10px 15px;
color: #fff;
position: relative;
cursor: pointer;
}
.tabbar .tabs>li.active:after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: -2px;
height: 2px;
background: inherit;
}
.tabbar .tabs>li:nth-child(1),
.tabbar .pages>li:nth-child(1){
background: blue;
}
.tabbar .tabs>li:nth-child(2),
.tabbar .pages>li:nth-child(2){
background: green;
}
.tabbar .tabs>li:nth-child(3),
.tabbar .pages>li:nth-child(3){
background: red;
}
<div class="tabbar">
<ul class="tabs">
<li page="#page-1">First</li>
<li page="#page-2" class="active">Second</li>
<li page="#page-3">Third</li>
</ul>
<ul class="pages">
<li id="page-1">Page 1</li>
<li id="page-2" class="active">Page 2</li>
<li id="page-3">Page 3</li>
</ul>
</div>

Drawing a tick mark in the progressbar if the process is done

I was created a simple progressbar with CSS & HTML. Here I used three classes active, inactive & done.
.container {
width: 600px;
margin: 100px auto;
}
.progressbar li {
list-style-type: none;
width: 25%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
color: #7d7d7d;
}
.progressbar li:before {
width: 30px;
height: 30px;
content: "";
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.progressbar li:after {
width: 100%;
height: 2px;
content: '';
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.progressbar li:first-child:after {
content: none;
}
.progressbar li.active {
color: green;
}
.progressbar li.active:before {
border-color: #55b776;
background-color: #55b776;
}
.progressbar li.active+li:after {
background-color: #55b776;
}
.progressbar li.done:before {
border-color: #55b776;
background-color: #55b776;
}
.progressbar li.done+li:after {
background-color: #55b776;
}
.progressbar li.inactive:before {
border-color: #7d7d7d;
background-color: #7d7d7d;
}
.progressbar li.inactive+li:after {
background-color: #7d7d7d;
}
<div class="container">
<ul class="progressbar">
<li class="done"></li>
<li class="active"></li>
<li class="inactive"></li>
</ul>
</div>
If the class is active it will show the circle with background-color: green,
If the class is inactive it will show the circle with background-color: grey
What i want is while using class 'done' i need to show the circle with background-color: green and tick mark inside the green circle like this. I tried a lot but not able to finish it. Please someone help me. Here is my working fiddle link
Use tick mark in content: "βœ“";
.container {
width: 600px;
margin: 100px auto;
}
.progressbar li {
list-style-type: none;
width: 25%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
color: #7d7d7d;
}
.progressbar li:before {
width: 30px;
height: 30px;
content: "";
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.progressbar li.done:before {
content: "βœ“";
color: #ffffff;
font-size: 20px;
}
.progressbar li:after {
width: 100%;
height: 2px;
content: '';
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.progressbar li:first-child:after {
content: none;
}
.progressbar li.active {
color: green;
}
.progressbar li.active:before {
border-color: #55b776;
background-color: #55b776;
}
.progressbar li.active + li:after {
background-color: #55b776;
}
.progressbar li.done:before {
border-color: #55b776;
background-color: #55b776;
}
.progressbar li.done + li:after {
background-color: #55b776;
}
.progressbar li.inactive:before {
border-color: #7d7d7d;
background-color: #7d7d7d;
}
.progressbar li.inactive + li:after {
background-color: #7d7d7d;
}
<div class="container">
<ul class="progressbar">
<li class="done"></li>
<li class="active"></li>
<li class="inactive"></li>
</ul>
</div>
As per your Requirements using css
.container {
width: 600px;
margin: 100px auto;
}
.progressbar li {
list-style-type: none;
width: 25%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
color: #7d7d7d;
}
.progressbar li:before {
width: 30px;
height: 30px;
content: "";
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.progressbar li:after {
width: 100%;
height: 2px;
content: '';
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.progressbar li:first-child:after {
content: none;
}
.progressbar li.active {
color: green;
}
.progressbar li.active:before {
border-color: #55b776;
background-color: #55b776;
}
.progressbar li.active + li:after {
background-color: #55b776;
}
.progressbar li.done:before {
border-color: #55b776;
background-color: #55b776;
}
.progressbar li.done + li:after {
background-color: #55b776;
}
.progressbar li.inactive:before {
border-color: #7d7d7d;
background-color: #7d7d7d;
}
.progressbar li.inactive + li:after {
background-color: #7d7d7d;
}
.progressbar li.done {
font-size: 16px;
position: relative;
}
.progressbar li.done:after {
content: " ";
display: block;
width: 0.3em;
height: 0.6em;
border: solid white;
border-width: 0 0.2em 0.2em 0;
position: absolute;
left: 4.2em;
top: 26%;
margin-top: -0.2em;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
z-index:9;
background-color: #55b776;
}
<div class="container">
<ul class="progressbar">
<li class="done"></li>
<li class="active"></li>
<li class="inactive"></li>
</ul>
</div>
You only need to set the content to the tick mark when the done class is applied.
.progressbar li.done:before {
content: "βœ”";
}
Wirking fiddle: https://jsfiddle.net/ordmpf59/

Stepper Pure HTML CSS

I'm confused about a progress bar that I have created.
I want the progress bar to change its background color to blue after setting the class to β€œactive”. But I want the progress bar to change its background color before the class is set to β€œactive”.
Here is my HTML:
<ul class="progressBar">
<li class="active">Beong Processed</li>
<li class="active">Waiting for payment</li>
<li>Paid</li>
</ul>
…and CSS:
.progressBar li.active {
color: dodgerblue;
}
.progressBar li.active:before {
border-color: dodgerblue;
background-color: dodgerblue
}
.progressBar li.active + li:after {
background-color: dodgerblue;
}
The result is this
I want it to be like this
https://jsfiddle.net/dedi_wibisono17/c69e374r/2/
Use .progressBar .active:after
instead of .progressBar li.active + li:after
+ in css
It is Adjacent sibling combinator. It combines two sequences of simple
selectors having the same parent and the second one must come
IMMEDIATELY after the first.
.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: 4px;
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 .active:after {
background-color: dodgerblue;
}
<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>
According to what you requested, this is more like the answer you asked for?
.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: 17px;
height: 17px;
border: 1px solid #ddd;
border-left:none;
display: block;
text-align: center;
margin: 8.5px auto 0px;
background-color: #eee;
}
.progressBar li:after {
content: "";
position: absolute;
width: 97%;
height: 5px;
background-color: #eee;
border: 1px solid #ddd;
border-right:none;
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 .active:after {
background-color: dodgerblue;
}
<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>
Try changing your .progressBar li.active + li:after selector to .progressBar li.active:after
.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:after {
background-color: dodgerblue;
}
<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>

Horizontal CSS Wizard Navigation

I am trying to build up a horizontal css wizard navigation with a rounded css circle and text on each step. I am stuck on 1 point need to get ride on border from right side. Tried almost all steps. Attaching the code.
Attaching the screenshot of issue as well.
error image
ul {
text-align: justify;
position: relative;
overflow: hidden;
margin: 0;
padding: 0;
}
ul:before {
content: '';
width: 96%;
border: 2px solid #21a2d1;
position: absolute;
top: 1em;
margin-top: -6px;
z-index: -1;
margin-left: 16px;
}
.active:after {
content: '';
width: 100%;
border: 2px solid #b7b7b7;
position: absolute;
top: 1em;
margin-top: -6px;
z-index: -1;
}
ul:after {
content: '';
display: inline-block;
width: 100%;
}
li {
width: 1.5em;
height: 1.5em;
text-align: center;
line-height: 1.7em;
border-radius: 50%;
background: #21a2d1;
margin: 0 1em;
display: inline-block;
}
.marker-number {
font-size: 14px;
}
li.active {
background: #04497b;
}
.active ~ li {
background: #b7b7b7;
}
span.marker-text {
color: #7d7d7d;
font-size: 12px;
line-height: 16px;
width: 70px;
display: block;
margin-left: -21px;
font-family: Arial;
}
<ul>
<li><span class="marker-number"> </span> <span class="marker-text">Select Car</span></li>
<li><span class="marker-number"> </span> <span class="marker-text">Questions</span></li>
<li class="active"><span class="marker-number"> </span> <span class="marker-text">Problems</span></li>
<li><span class="marker-number"> </span> <span class="marker-text">Inspection</span></li>
<li><span class="marker-number"> </span> <span class="marker-text">Solution</span></li>
</ul>
Here is a sample, using flexbox, with a minimal markup, and for the marker the ::before pseudo and the line the ::after pseudo (starting from the 2:nd position)
ul.wizard, ul.wizard li {
margin: 0;
padding: 0;
display: flex;
width: 100%;
}
ul.wizard {
counter-reset: num;
}
ul.wizard li {
flex-direction: column;
align-items: center;
position: relative;
}
ul.wizard li::before {
counter-increment: num;
content: counter(num);
width: 1.5em;
height: 1.5em;
text-align: center;
line-height: 1.5em;
border-radius: 50%;
background: #21a2d1;
}
ul.wizard li ~ li::after {
content: '';
position: absolute;
width: 100%;
right: 50%;
height: 4px;
background-color: #21a2d1;
top: calc(.75em - 2px);
z-index: -1;
}
ul.wizard li.active::before {
background: #04497b;
color: white;
}
ul.wizard .active ~ li::before,
ul.wizard .active ~ li::after {
background: #b7b7b7;
}
ul.wizard span {
color: #7d7d7d;
font-size: 12px;
font-family: Arial;
}
/* updated sample */
ul.wizard li.completed::before { /* number and circle */
background: red;
color: white;
}
ul.wizard li.completed span { /* text */
color: red;
}
ul.wizard li.completed + li::after { /* line after circle */
background: red;
}
ul.wizard li.completed::after { /* line before circle */
background: red;
}
<ul class="wizard">
<li>
<span>Select Car</span>
</li>
<li class="completed">
<span>Questions</span>
</li>
<li class="active">
<span>Problems</span>
</li>
<li>
<span>Inspection</span>
</li>
<li>
<span>Solution</span>
</li>
</ul>
This can also be done without flexbox, if you need to target older browsers
ul.wizard, ul.wizard li {
margin: 0;
padding: 0;
}
ul.wizard {
counter-reset: num;
}
ul.wizard li {
list-style-type: none;
float: left;
width: 20%;
position: relative;
text-align: center;
}
ul.wizard li::before {
display: block;
counter-increment: num;
content: counter(num);
width: 1.5em;
height: 1.5em;
text-align: center;
line-height: 1.5em;
border-radius: 50%;
background: #21a2d1;
margin: 0 auto;
}
ul.wizard li ~ li::after {
content: '';
position: absolute;
width: 100%;
right: 50%;
height: 4px;
background-color: #21a2d1;
top: calc(.75em - 2px);
z-index: -1;
}
ul.wizard li.active::before {
background: #04497b;
color: white;
}
ul.wizard .active ~ li::before,
ul.wizard .active ~ li::after {
background: #b7b7b7;
}
ul.wizard span {
display: inline-block;
color: #7d7d7d;
font-size: 12px;
font-family: Arial;
}
<ul class="wizard">
<li>
<span>Select Car</span>
</li>
<li>
<span>Questions</span>
</li>
<li class="active">
<span>Problems</span>
</li>
<li>
<span>Inspection</span>
</li>
<li>
<span>Solution</span>
</li>
</ul>
Reduce width of pseudo element :befor to 90% and :after to 45% but you have to write it always different width percentages as per the activated li tag and as per screen size. I think If you modify your markup a little bit which will help you more and make the complications less.
============================================================
Changed markup as you required and few tweaks in css
ul {
text-align: justify;
position: relative;
overflow: hidden;
margin: 0;
padding: 0;
display: inline-flex;
justify-content: space-around;
width: 100%;
}
li {
position: relative;
width: 20%;
text-align: center;
display: inline;
padding-bottom: 20px;
}
.marker-number {
width: 1.5em;
height: 1.5em;
text-align: center;
line-height: 1.7em;
border-radius: 50%;
background: #21a2d1;
display: inline-block;
}
.marker-line {
position: absolute;
width: 100%;
height: 4px;
background-color: #21a2d1;
top: 10px;
}
li.active span.marker-number,
li.active span.marker-line {
background: #04497b;
}
.active ~ li span.marker-number,
.active ~ li span.marker-line {
background: #b7b7b7;
}
span.marker-text {
color: #7d7d7d;
font-size: 12px;
line-height: -15px;
font-family: Arial;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
<ul>
<li>
<span class="marker-number"> </span>
<span class="marker-line"></span>
<span class="marker-text">Select Car</span>
</li>
<li>
<span class="marker-number"> </span>
<span class="marker-line"></span>
<span class="marker-text">Questions</span>
</li>
<li class="active">
<span class="marker-number"> </span>
<span class="marker-line"></span>
<span class="marker-text">Problems</span>
</li>
<li>
<span class="marker-number"> </span>
<span class="marker-line"></span>
<span class="marker-text">Inspection</span>
</li>
<li>
<span class="marker-number"> </span>
<span class="marker-text">Solution</span>
</li>
</ul>