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;
}









share|improve this question






















  • 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















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;
}









share|improve this question






















  • 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













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;
}









share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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


















  • 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












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>








share|improve this answer





















    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',
    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
    });


    }
    });














    draft saved

    draft discarded


















    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








    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>








    share|improve this answer

























      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>








      share|improve this answer























        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>








        share|improve this answer












        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>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 7:09









        Auroratide

        62128




        62128






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Florida Star v. B. J. F.

            Error while running script in elastic search , gateway timeout

            Adding quotations to stringified JSON object values