Step Progress Bar Icons
up vote
0
down vote
favorite
I'm trying to set up a little step progress bar that only has an icon for the current step. I've gotten so far as to have a default icon of sorts, but can't figure out how to clear it for non-active steps.
In the code below, I tried playing with pseudo classes but that didn't seem to work. I'm wondering if anyone can point me in the right direction. Thanks!
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
font-family: "FontAwesome";
content: "f276";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active):nth-of-type(2) > *::before {
content: none;
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
css
add a comment |
up vote
0
down vote
favorite
I'm trying to set up a little step progress bar that only has an icon for the current step. I've gotten so far as to have a default icon of sorts, but can't figure out how to clear it for non-active steps.
In the code below, I tried playing with pseudo classes but that didn't seem to work. I'm wondering if anyone can point me in the right direction. Thanks!
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
font-family: "FontAwesome";
content: "f276";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active):nth-of-type(2) > *::before {
content: none;
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
css
Can you provide your HTML? Edit your question and add a code snippet so we can see it in action.
– chazsolo
Nov 11 at 2:34
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to set up a little step progress bar that only has an icon for the current step. I've gotten so far as to have a default icon of sorts, but can't figure out how to clear it for non-active steps.
In the code below, I tried playing with pseudo classes but that didn't seem to work. I'm wondering if anyone can point me in the right direction. Thanks!
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
font-family: "FontAwesome";
content: "f276";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active):nth-of-type(2) > *::before {
content: none;
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
css
I'm trying to set up a little step progress bar that only has an icon for the current step. I've gotten so far as to have a default icon of sorts, but can't figure out how to clear it for non-active steps.
In the code below, I tried playing with pseudo classes but that didn't seem to work. I'm wondering if anyone can point me in the right direction. Thanks!
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
font-family: "FontAwesome";
content: "f276";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active):nth-of-type(2) > *::before {
content: none;
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
css
css
asked Nov 11 at 2:28
DD1229
337
337
Can you provide your HTML? Edit your question and add a code snippet so we can see it in action.
– chazsolo
Nov 11 at 2:34
add a comment |
Can you provide your HTML? Edit your question and add a code snippet so we can see it in action.
– chazsolo
Nov 11 at 2:34
Can you provide your HTML? Edit your question and add a code snippet so we can see it in action.
– chazsolo
Nov 11 at 2:34
Can you provide your HTML? Edit your question and add a code snippet so we can see it in action.
– chazsolo
Nov 11 at 2:34
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
For this answer, I am assuming the following is your HTML structure:
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
The issue is with the following declaration:
.step-indicator li:not(.active):nth-of-type(2) > *::before {
content: none;
}
This is targeting the ::before
of a descendant of the li
tag. However, you actually put your symbol on the ::before
of the li
tag itself, not a descendant. Therefore, that's what you need to be targeting. Furthermore, content: none
eliminates the ::before
, so you actually want content: ""
. Here's what I think you actually want:
.step-indicator li:not(.active)::before {
content: "";
}
And here's the full code snippet (note I replaced your symbol with the $):
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
content: "$";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active)::before {
content: "";
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
For this answer, I am assuming the following is your HTML structure:
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
The issue is with the following declaration:
.step-indicator li:not(.active):nth-of-type(2) > *::before {
content: none;
}
This is targeting the ::before
of a descendant of the li
tag. However, you actually put your symbol on the ::before
of the li
tag itself, not a descendant. Therefore, that's what you need to be targeting. Furthermore, content: none
eliminates the ::before
, so you actually want content: ""
. Here's what I think you actually want:
.step-indicator li:not(.active)::before {
content: "";
}
And here's the full code snippet (note I replaced your symbol with the $):
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
content: "$";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active)::before {
content: "";
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
add a comment |
up vote
1
down vote
accepted
For this answer, I am assuming the following is your HTML structure:
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
The issue is with the following declaration:
.step-indicator li:not(.active):nth-of-type(2) > *::before {
content: none;
}
This is targeting the ::before
of a descendant of the li
tag. However, you actually put your symbol on the ::before
of the li
tag itself, not a descendant. Therefore, that's what you need to be targeting. Furthermore, content: none
eliminates the ::before
, so you actually want content: ""
. Here's what I think you actually want:
.step-indicator li:not(.active)::before {
content: "";
}
And here's the full code snippet (note I replaced your symbol with the $):
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
content: "$";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active)::before {
content: "";
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
For this answer, I am assuming the following is your HTML structure:
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
The issue is with the following declaration:
.step-indicator li:not(.active):nth-of-type(2) > *::before {
content: none;
}
This is targeting the ::before
of a descendant of the li
tag. However, you actually put your symbol on the ::before
of the li
tag itself, not a descendant. Therefore, that's what you need to be targeting. Furthermore, content: none
eliminates the ::before
, so you actually want content: ""
. Here's what I think you actually want:
.step-indicator li:not(.active)::before {
content: "";
}
And here's the full code snippet (note I replaced your symbol with the $):
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
content: "$";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active)::before {
content: "";
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
For this answer, I am assuming the following is your HTML structure:
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
The issue is with the following declaration:
.step-indicator li:not(.active):nth-of-type(2) > *::before {
content: none;
}
This is targeting the ::before
of a descendant of the li
tag. However, you actually put your symbol on the ::before
of the li
tag itself, not a descendant. Therefore, that's what you need to be targeting. Furthermore, content: none
eliminates the ::before
, so you actually want content: ""
. Here's what I think you actually want:
.step-indicator li:not(.active)::before {
content: "";
}
And here's the full code snippet (note I replaced your symbol with the $):
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
content: "$";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active)::before {
content: "";
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
content: "$";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active)::before {
content: "";
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
.step-indicator-container {
width: 600px;
margin: 100px auto;
}
.step-indicator li {
list-style-type: none;
width: 33.33%;
float: left;
font-size: 12px;
position: relative;
text-align: center;
text-transform: uppercase;
color: #7d7d7d;
}
.step-indicator li:before {
content: "$";
width: 30px;
height: 30px;
line-height: 30px;
border: 2px solid #7d7d7d;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: white;
}
.step-indicator li:after {
width: 100%;
height: 2px;
content: "";
position: absolute;
background-color: #7d7d7d;
top: 15px;
left: -50%;
z-index: -1;
}
.step-indicator li:not(.active)::before {
content: "";
}
.step-indicator li:first-child:after {
content: none;
}
.step-indicator li.active {
color: #0052e7;
}
.step-indicator li.active:before {
border-color: #0052e7;
}
.step-indicator li.active+li:after {
background-color: #0052e7;
}
<div class="step-indicator-container">
<ul class="step-indicator">
<li></li>
<li class="active"></li>
<li></li>
</ul>
</div>
answered Nov 11 at 7:09
Auroratide
62128
62128
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245334%2fstep-progress-bar-icons%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you provide your HTML? Edit your question and add a code snippet so we can see it in action.
– chazsolo
Nov 11 at 2:34