Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 8 months ago

password generator

P
Loic Cape•290
@loiccape
A solution to the Password generator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I successfully created a functional password generator. I prioritized having multiple functions with specific functionalities rather than large functions with a lot of code.

What challenges did you encounter, and how did you overcome them?

I didnt know how to put the background color following the cursor on the range input

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Rohloffmeister•470
    @Rohloffmeister
    Posted 8 months ago

    The text looks generally good, but there are a few minor errors that can be corrected. Here's the revised version:

    "Looks very good! Especially the JavaScript is very nice!

    First, to your range input.

    I did it with JavaScript because I couldn't find a way to do it in CSS.

    slider.addEventListener("input", function () {
      const value = (slider.value - slider.min) / (slider.max - slider.min) * 100;
      slider.style.background = `linear-gradient(to right, var(--green) ${value}%, var(--very-dark) ${value}%)`;
    });
    

    First, the position of the slider is calculated and gives back a percentage value (const value =...).

    This is used to give the slider a linear-gradient background, and the value is inserted. Because the end and start value of the gradient is the same value, it will be instant. This is done every time the slider is moved.

    If you do this, you would also need to add the linear-gradient to your stylesheet according to the starting value of your range input. In your case, it's 50%:

    input[type="range"] {
      ...
      background: linear-gradient(
        to right,
        var(--green) 50%,
        var(--very-dark) 50%
      );
      ...
    }
    

    Also, I personally would change the min and max of the range input to something like 0-20. Having a generally higher range also makes the input feel way smoother.

    If you would like to change the thumb of the slider, here's how I did it:

    input[type="range"] {
      width: 100%;
      height: 10px;
      appearance: none;
      background: linear-gradient(
        to right,
        var(--light-neon-green) 50%,
        var(--dark-gray) 50%
      );
      border-radius: 25px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
      height: 25px;
      width: 25px;
      border-radius: 50%;
      background-color: var(--dark-gray);
      border: 2px solid var(--light-neon-green);
      appearance: none;
    }
    
    input[type="range"]::-moz-range-thumb {
      height: 25px;
      width: 25px;
      border-radius: 50%;
      background-color: var(--dark-gray);
      border: 2px solid var(--light-neon-green);
      appearance: none;
    }
    

    The last two selectors do the same, but the last one is especially for Firefox.

    Important is that you do appearance: none; this overrides the standard look of the browser.

    Otherwise, your code looks good. Great Job!

    If you want to check out my implementation, here's the link: Frontend Mentor Project

    Marked as helpful

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