Step Progress Bar Icons
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 |
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 '18 at 2:34
add a comment |
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 '18 at 2:28
DD1229DD1229
317
317
Can you provide your HTML? Edit your question and add a code snippet so we can see it in action.
– chazsolo
Nov 11 '18 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 '18 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 '18 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 '18 at 2:34
add a comment |
1 Answer
1
active
oldest
votes
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 |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 |
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 |
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 '18 at 7:09
AuroratideAuroratide
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.
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 '18 at 2:34