Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 3 years ago

Interactive Rating Component

Aayush Kumar•110
@AK-CHP1
A solution to the Interactive rating component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I found it difficult to select colors. Also the colors mentioned in the style guide were not matching perfectly with the design images. I implemented the rating buttons using span elements and used javascript to show their states when clicked. Could it be implemented differently using just HTML/CSS. Also, the. Please suggest how to exactly measure the relative size of each element in the design to achieve a pixel perfect design.

Any further suggestions or feedback are welcome!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Abdullah Ayoola•1,080
    @abdullah43577
    Posted almost 3 years ago

    Hello There,

    You've done a great job taking on this challenge.

    Sometimes the colours given in the template files don't exactly match the design given to us. But it's not all the time. Atimes you might need to work your way around that. That shouldn't be a problem.

    Also, the challenge requested to use HTML CSS and javascript, you can't listen for clicks with just HTML and CSS before we're even talking about manipulating the DOM.

    what I noticed when looking at your website is that the span elements which you used for the rating numbers aren't of the best design if I'm to be honest with you. But you can change that by giving them all a specified width and also a border-radius of 100%, that should make the container wrapping those elements 100% rounded. The same thing applies to the star container as well. And instead of using span, why not just use div. Please do note that you can achieve the same result using span.

    But I think div would be just fine for this. Set the specified width, you don't need to specify the height it should automatically be set to auto by default, so each container carries the same height. and never bigger than each other. You can given them all a specific class that styles them all together, instead of styling them one after the other.

    PS. Just a quick tip, if you might find this helpful:

    Just incase you're wondering why a style isn't working as expected you can use the dev console tools and navigate to the computed tab (usually by the right if your dev console if set to view at the bottom), and then check to view which styles are being applied to the element you're having issue with. It can really come in handy especially when there are styles overriding each other.

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

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