Skip to content
  • Learning paths
  • Challenges
  • Solutions
  • Articles
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

Responsive simple rating app using HTML/CSS/JavaScript

M A•170
@Mikkobelly
A solution to the Interactive rating component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I am very new to web development field and this is the first project I did HTML,CSS and JavaScript. To create this simple rating app, I wrote a single HTML page and made it work as overwriting the entire HTML page using JavaScript when clicking the 'submit' button. I'm not sure if this was the best way.. Is it possible to create 2 different HTML pages (rating app page and after-submit page) referencing the same JS, then extracting data from one page and apply to another?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Lucas 👾•104,200
    @correlucas
    Posted over 2 years ago

    👾Hello @Mikkobelly, congratulations for your new solution! Your component is perfect, but is not responsive yet, this is due the fixed width you've applied to the container.

    Look both width and max-width the main difference between these properties is that the first(width) is fixed and the second(max-width) is flexible, for example, a component with width: 320px will not grow or shrink because the size will be ever the same, but a container with max-width: 320px or min-width: 320px can grow or contract depending of the property you've set for the container. So if you want a responsive block element, never use width choose or min-width or max-width.

    Note that there's no need to use height here, because since you set a height for an element, this means that this element will grow until a certain point and after that the inner content (as texts or images) will start to pop out the element due its fixed height, so isn't necessary to set the height the container height comes from the elements, its paddings and height.

    Here's your code fixed:

    .main-container {
        /* width: 25%; */
        max-width: 320px;
        display: flex;
        flex-direction: column;
        background-color: hsl(213, 19%, 18%);
        border: none;
        border-radius: 20px;
        padding: 35px 35px;
    }
    

    add this to the button with the numbers get responsive flex-wrap: wrap:

    .rate-buttons {
        flex-wrap: wrap;
        display: flex;
        justify-content: space-between;
        text-align: center;
        margin-bottom: 30px;
    }
    

    ✌️ I hope this helps you and happy coding!

    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

Oops! 😬

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

Log in with GitHub