I already figure out to do the circle steps horizontally. But to do like the picture below is quite stressful. Can you figure out how to do this?
Here is code
.container-progress {
margin: 100px auto;
font-size: 24px;
font-weight: bold;
font-family: Verdana;
color: white;
margin-top: 50px;
padding: 0;
}
.progressbar {
margin: 0;
padding: 0;
counter-reset: step;
}
.progressbar li {
list-style-type: none;
width: 16%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
}
.progressbar li:before {
width: 5em;
height: 5em;
content: counter(step);
counter-increment: step;
line-height: 90px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
padding: 0;
border-radius: 50%;
background-color: black;
font-size: 18px;
font-weight: bold;
}
.progressbar li:after {
margin-top: 30px;
width: 100%;
height: .5em;
content: '';
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.progressbar li:first-child:after {
content: none;
}
.progressbar li.active {
color: white;
}
.progressbar li.active:before {
border-color: dodgerblue;
background: dodgerblue;
}
.progressbar li.active+li:after {
/*background-color: dodgerblue;*/
}
.progressbar label {
color: black;
}
<div class="container-progress">
<ul class="progressbar">
<li class="active active-step">
<label>step 1</label>
</li>
<li>
<label>step 2</label>
</li>
<li>
<label>step 3</label>
</li>
<li>
<label>step 4</label>
</li>
<li>
<label>step 5</label>
</li>
<li>
<label>step 6</label>
</li>
</ul>
</div>
Fiddle link
This uses a border on the ul to create your connecting lines and uses position:absolute to position the individual steps. You will probably need to tweak it a bit more but it could get you moving in the right direction.
Edit
To get the first three label to appear above ther cirlces, swap :before with :after. I've updated my code to reflect this.
.container-progress {
margin: 100px auto;
font-size: 24px;
font-weight: bold;
font-family: Verdana;
color: white;
margin-top: 50px;
padding: 0;
}
.progressbar {
margin: 0 50px;
padding: 0;
counter-reset: step;
position:relative;
border: 2px solid #7d7d7d;
border-left:none;
min-height:200px;
}
.progressbar li {
list-style-type: none;
width: 16%;
/*float: left;*/
font-size: 12px;
position: absolute;
text-align: center;
text-transform: uppercase;
}
/*First Three*/
.progressbar li:nth-child(-n+3)
{
top:-45px
}
/*Last Three*/
.progressbar li:nth-last-child(-n+3)
{
bottom:-75px
}
/*Left*/
.progressbar li:nth-child(1), .progressbar li:nth-child(6)
{
left:-45px
}
/*Middle*/
.progressbar li:nth-child(2), .progressbar li:nth-child(5)
{
left:calc(50% - 45px);
}
/*Right*/
.progressbar li:nth-child(3), .progressbar li:nth-child(4)
{
left:calc(100% - 45px);
}
.progressbar li:nth-last-child(-n+3):before, .progressbar li:nth-child(-n+3):after {
width: 5em;
height: 5em;
content: counter(step);
counter-increment: step;
line-height: 90px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
padding: 0;
border-radius: 50%;
background-color: black;
font-size: 18px;
font-weight: bold;
}
/*.progressbar li:after {
margin-top: 30px;
width: 100%;
height: .5em;
content: '';
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}*/
/*.progressbar li:first-child:after {
content: none;
}*/
.progressbar li.active {
color: white;
}
.progressbar li.active:before, .progressbar li.active:after {
border-color: dodgerblue;
background: dodgerblue;
}
.progressbar li.active+li:after {
/*background-color: dodgerblue;*/
}
.progressbar label {
color: black;
}
<div class="container-progress">
<ul class="progressbar">
<li class="active active-step">
<label>step 1</label>
</li>
<li>
<label>step 2</label>
</li>
<li>
<label>step 3</label>
</li>
<li>
<label>step 4</label>
</li>
<li>
<label>step 5</label>
</li>
<li>
<label>step 6</label>
</li>
</ul>
</div>
Related
I'm very new into coding and I wanted to add a progress bar on my website. But when I want to make the step1 "active", it's the step2 that gets active (and when I make the step 2 active, it's the step 3 that gets active and so on)
<div id="fh5co-work">
<div class="row">
<div class="col-md-8">
<div class="root">
<div class="container">
<ul class="progressbar">
<li class="active">Step 1</li>
<li>Step 2</li>
<li>Step 3</li>
<li>Step 4</li>
<li>Step 5</li>
</ul>
</div>
</div>
Here's the css code in the bootstrap.css:
.container{
width: 140%;
position: absolute;
z-index: 1;
}
.progressbar li{
float: left;
width: 20%;
position: relative;
text-align: center;
}
.progressbar li:before{
content:"1";
width: 30px;
height: 30px;
border: 2px solid #bebebe;
display: block;
margin: 0 auto 10px auto;
border-radius: 50%;
line-height: 27px;
background: white;
color: #bebebe;
text-align: center;
font-weight: bold;
}
.progressbar{
counter-reset: step;
}
.progressbar li:before{
content:counter(step);
counter-increment: step;
width: 30px;
height: 30px;
border: 2px solid #bebebe;
display: block;
margin: 0 auto 10px auto;
border-radius: 50%;
line-height: 27px;
background: white;
color: #bebebe;
text-align: center;
font-weight: bold;
}
.progressbar li:after{
content: '';
position: absolute;
width:100%;
height: 3px;
background: #37606f;
top: 15px;
left: -50%;
z-index: -1;
}
.progressbar li:first-child:after{
content: none;
}
.progressbar li.active + li:after{
background: #37606f;
}
.progressbar li.active + li:before{
border-color: #37606f;
background: #37606f;
color: white
}
What can I do to make it work?
When I changed the style definition .progressbar li.active + li:before in css to .progressbar li.active:before, the problem went away.
.container{
width: 140%;
position: absolute;
z-index: 1;
}
.progressbar li{
float: left;
width: 20%;
position: relative;
text-align: center;
}
.progressbar li:before{
content:"1";
width: 30px;
height: 30px;
border: 2px solid #bebebe;
display: block;
margin: 0 auto 10px auto;
border-radius: 50%;
line-height: 27px;
background: white;
color: #bebebe;
text-align: center;
font-weight: bold;
}
.progressbar{
counter-reset: step;
}
.progressbar li:before{
content:counter(step);
counter-increment: step;
width: 30px;
height: 30px;
border: 2px solid #bebebe;
display: block;
margin: 0 auto 10px auto;
border-radius: 50%;
line-height: 27px;
background: white;
color: #bebebe;
text-align: center;
font-weight: bold;
}
.progressbar li:after{
content: '';
position: absolute;
width:100%;
height: 3px;
background: #37606f;
top: 15px;
left: -50%;
z-index: -1;
}
.progressbar li:first-child:after{
content: none;
}
.progressbar li.active + li:after{
background: #37606f;
}
.progressbar li.active:before{
border-color: #37606f;
background: #37606f;
color: white
}
<div id="fh5co-work">
<div class="row">
<div class="col-md-8">
<div class="root">
<div class="container">
<ul class="progressbar">
<li class="active">Step 1</li>
<li>Step 2</li>
<li>Step 3</li>
<li>Step 4</li>
<li>Step 5</li>
</ul>
</div>
</div>
</div>
</div>
</div>
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>
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>
We have used a pure css base progress bar.
The main css part is as below.
.container {
width: 600px;
margin: 20px auto;
}
.progressbar {
margin: 0;
padding: 0;
counter-reset: step;
}
.progressbar li {
list-style-type: none;
width: 25%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.progressbar li:before {
width: 30px;
height: 30px;
content: counter(step);
counter-increment: step;
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;
}
...............
The html
<div class="container">
<ul class="progressbar">
<li class="active">login</li>
<li>choose interest</li>
........
Complete sample could be found at https://jsfiddle.net/wbj7e79p/.
As you can see it mess up for seven step. The reason is .progressbar li width which is fixed to 25% we wanted to make it dynamic base on number of steps.
So we tried width : calc (100% / steps) or calc (100% / counter(steps)) but none of them worked. Any idea !
Please consider that we are building a component which build a progress bar on the fly, so we can not find the actual number of steps
Did you consider flexbox?
body {
font-family: 'Alegreya Sans', sans-serif;
margin: 0;
padding: 0;
}
.container {
margin: 20px auto;
}
.progressbar {
margin: 0;
padding: 0;
counter-reset: step;
display: flex;
}
.progressbar li {
list-style-type: none;
flex: 1;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.progressbar li:before {
width: 30px;
height: 30px;
content: counter(step);
counter-increment: step;
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;
}
.progressbar li.active + li:after {
background-color: #55b776;
}
<h1>Four Steps</h1>
<div class="container">
<ul class="progressbar">
<li class="active">login</li>
<li>choose interest</li>
<li>add friends</li>
<li>View map</li>
</ul>
</div>
<h1> Seven Steps</h1>
<div class="container">
<ul class="progressbar">
<li class="active">login</li>
<li>choose interest</li>
<li>add friends</li>
<li>remove</li>
<li>fix users</li>
<li>review</li>
<li>save all</li>
</ul>
</div>
I try to create a progress line for my page that looks like that:
(1)------------(2)------------(3)------------(4)
Step #1 Step #2 Step #3 Step #4
but I cannot set the last bullet of my list to stay at the very very right.
The code I have write is based on ul list, and you can find the sample code on jsfiddle.
My code is the following:
.container {
padding: 60px;
}
#progress-container {
margin: 0;
padding: 0;
list-style: none;
border-top: 2px solid #999;
position: relative;
margin-top: 20px;
}
#progress-container li {
margin: 0;
padding: 0;
list-style: none;
position: relative;
display: inline-block;
width: 24%;
text-align: center;
padding-top: 20px;
font-size: 16px;
color: #2A668A;
}
#progress-container li::before {
content: '1';
position: absolute;
top: -20px;
left: 45%;
background: #EEB0B1;
padding: 5px 12px;
font-size: 18px;
text-align: center;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
color: #FFF;
font-weight: bold;
}
#progress-container li.active::before {
background: #d33434;
}
#progress-container li:nth-child(1) {
margin-left: -12%;
}
#progress-container li:nth-child(1)::before {
content: '1';
}
#progress-container li:nth-child(2) {
margin-left: 6%;
}
#progress-container li:nth-child(2)::before {
content: '2';
}
#progress-container li:nth-child(3) {
margin-left: 6%;
}
#progress-container li:nth-child(3)::before {
content: '3';
}
#progress-container li:nth-child(4) {
margin-right: 12%;
}
#progress-container li:nth-child(4)::before {
content: '4';
}
<div class="container">
<ul id="progress-container">
<li class="active">
Level #1
</li>
<li>
Level #2
</li>
<li>
Level #3
</li>
<li>
Level #4
</li>
</ul>
</div>
Note : The code in JsFiddle is the current one that needs to be corrected. If you have any suggestion on how to fix the visual problem, please help, or if you have any other way to do it, just tell me :)
UPDATE
Just if somebody is interested in the feature the code is here:
#progress-container.horizontal {
margin: 20px 0 0;
padding: 0;
list-style: none;
border-top: 2px solid #999;
position: relative;
}
#progress-container.horizontal li {
margin: 0;
padding: 20px 0 0;
list-style: none;
position: relative;
display: inline-block;
width: 24%;
text-align: center;
font-size: 16px;
color: #2A668A;
}
#progress-container.horizontal li::before {
content: '1';
position: absolute;
top: -20px;
left: 41%;
background: #EEB0B1;
padding: 5px 12px;
font-size: 18px;
text-align: center;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
color: #FFF;
font-weight: bold;
}
#progress-container.horizontal li.active::before {
background: #d33434;
}
#progress-container.horizontal li:nth-child(1) {
left: -12%;
}
#progress-container.horizontal li:nth-child(1)::before {
content: '1';
}
#progress-container.horizontal li:nth-child(2) {
left: -3%;
}
#progress-container.horizontal li:nth-child(2)::before {
content: '2';
}
#progress-container.horizontal li:nth-child(3) {
left: 5%;
}
#progress-container.horizontal li:nth-child(3)::before {
content: '3';
}
#progress-container.horizontal li:nth-child(4) {
left: 14%;
}
#progress-container.horizontal li:nth-child(4)::before {
content: '4';
}
#progress-container.vertical {
margin: 20px 0 0;
padding: 0;
list-style: none;
border-left: 2px solid #999;
position: relative;
}
#progress-container.vertical li {
margin: 0 0 25px;
padding: 0 0 0 50px;
list-style: none;
position: relative;
font-size: 16px;
color: #2A668A;
display: block;
left: -18px;
}
#progress-container.vertical li::before {
content: '';
position: absolute;
top: -6px;
left: 0;
background: #EEB0B1;
padding: 5px 12px;
font-size: 18px;
text-align: center;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
color: #FFF;
font-weight: bold;
}
#progress-container.vertical li.active::before {
background: #d33434;
}
#progress-container.vertical li:nth-child(1)::before {
content: '1';
}
#progress-container.vertical li:nth-child(2)::before {
content: '2';
}
#progress-container.vertical li:nth-child(3)::before {
content: '3';
}
#progress-container.vertical li:nth-child(4)::before {
content: '4';
}
<ul id="progress-container" class="horizontal hidden-xs">
<li class="active">
Step 1
</li>
<li>
Step 2
</li>
<li>
Step 3
</li>
<li>
Step 4
</li>
</ul>
<ul id="progress-container" class="vertical visible-xs">
<li class="active">
Step 1
</li>
<li>
Step 2
</li>
<li>
Step 3
</li>
<li>
Step 4
</li>
</ul>
Use CSS counters
*{box-sizing: border-box}
body{padding: 60px 0}
ul {
counter-reset: section;
list-style-type: none;
text-align: center
}
li:before {
counter-increment: section;
content: counters(section,"");
position: absolute;
top: -60px;
left: 50%;
margin-left: -15px;
width: 32px;
height: 32px;
border-radius: 50%;
background: red;
text-align: center;
line-height: 32px;
color: white
}
li.active, li:hover, li:hover:before{
color: #7cbee6
}
li.active:before, li:hover:before{
background: #012e54
}
li:not(:last-child):after{
content: '';
position: absolute;
top: -44px;
left: 70px;
width: 40px;
height: 1px;
border-top:2px dashed red
}
li{
display: inline;
position: relative;
padding: 10px 14px;
}
<div class="container">
<ul id="progress-container">
<li class="active">
Level #1
</li>
<li>
Level #2
</li>
<li>
Level #3
</li>
<li>
Level #4
</li>
</ul>
</div>
This seam to do the trick:
http://jsfiddle.net/3kngwfgf/2/
#progress-container li:nth-child(4) {
left: 12%;
}
I removed the margin-left: and just added left: