Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 1 year ago

Responsive PW Generator app using utility classes

P
Natalie Smyth•340
@nataliesmyth
A solution to the Password generator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What specific areas of your project would you like help with?

I would appreciate any help with changing the track fill color from black to green. I've tried using background image, borders, but I haven't been able to make it dynamic.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    RadaidehDaniel•430
    @RadaidehDaniel
    Posted 12 months ago

    Good job.

    The following example is how I deal with the range input. I hope this will be helpful.

    HTML

    <div class="slider">
                  <label for="character-length">Character Length</label>
                  <p id="slider-value">10</p>
                  <input
                    type="range"
                    id="character-length"
                    name="character-length"
                    min="1"
                    max="18"
                    step="1"
                    value="10"
                  />
                </div>
    

    CSS

    .slider {
      display: grid;
      grid-template-columns: 1fr 1fr;
      align-items: center;
      gap: 1.6rem;
    
      margin-block-end: 3.2rem;
    }
    
    .slider label {
      font-size: 1.8rem;
      font-weight: var(--font-bold);
      color: #e7e6eb;
    }
    
    .slider p {
      text-align: right;
    
      font-size: 3.2rem;
      font-weight: var(--font-bold);
      color: #a4ffaf;
    }
    
    #character-length {
      grid-column: 1/3;
      -webkit-appearance: none;
      background: transparent;
      cursor: pointer;
    
      background: linear-gradient(
        to right,
        #a4ffaf 0%,
        #a4ffaf 50%,
        #18171f 50%,
        #18171f 100%
      );
    }
    
    #character-length:focus {
      outline: none;
    }
    
    /***** Chrome, Safari, Opera, and Edge Chromium *****/
    #character-length::-webkit-slider-runnable-track {
      height: 0.8rem;
    }
    
    #character-length::-webkit-slider-thumb {
      -webkit-appearance: none;
      background-color: #e7e6eb;
      border-radius: 50%;
      height: 2.8rem;
      width: 2.8rem;
      margin-top: -10px;
    }
    
    #character-length:focus::-webkit-slider-thumb {
      background-color: #18171f;
      border: 1px solid #a4ffaf;
    }
    
    /******** Firefox ********/
    #character-length::-moz-range-track {
      height: 0.8rem;
    }
    
    #character-length::-moz-range-thumb {
      background-color: #e7e6eb;
      border: none;
      border-radius: 50%;
      height: 2.8rem;
      width: 2.8rem;
      margin-top: -10px;
    }
    
    #character-length:focus::-moz-range-thumb {
      background-color: #18171f;
      border: 1px solid #a4ffaf;
    }
    

    JavaScript

    const slider = document.getElementById("character-length");
    
    function renderSliderValue(e) {
      valueSlider.textContent = e.target.value;
    }
    
    function renderSlider(ele) {
      var value = ((ele.value - ele.min) / (ele.max - ele.min)) * 100;
      ele.style.background =
        "linear-gradient(to right, #a4ffaf 0%, #a4ffaf " +
        value +
        "%, #18171f " +
        value +
        "%, #18171f 100%)";
    }
    
    slider.addEventListener("input", function (e) {
      renderSliderValue(e);
      renderSlider(e.target);
    });
    

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub