Design comparison
Solution retrospective
Hi all,
in CSS I tried many different things for svg/img and span content to center them in their backgrounds (with background-color I made the background circle and the svg star and number written inside <span>1</span> weren't easy for me to center to the middle of this circle). Finally, I used display:flex & align-items and justify-content: center and I am not sure if this is the best practice or if the flexbox is too much for just centering.
Thanks for the advice!
Community feedback
- @nelsonleonePosted almost 2 years ago
Nice , congrats on completing the challenge , you can set a < width and aspect-ratio of 1/1 > on the spans so the can be round shaped when you add border radius,
For clicking the spans , (though using buttons would be also good) you can use JS , using the forEach method to remove all active buttons before making the clicked on active .
span.addEventlistener(....... document.querySelector(span).forEach(span => { span.remove.classList('active') })
e.target.classlist.add('active') )
0 - @DytomaPosted almost 2 years ago
Hey👋 Congratulation on completing this challenge, I really like your solution.
Here are some improvements you can implement to your code for accessibility:
- The proper way to build the "rating buttons" in this challenge is to create a
form
and inside of it, there should befive input radios
and each input should have alabel
attached to it to make the buttons accessible. Finally wrap all the inputs and labels inside afieldset
to prevent users from making more than one selection.
You can read:
This is one of the recommendation I got on my solution that I think you can implement to your code too.
Good Job👏
0 - The proper way to build the "rating buttons" in this challenge is to create a
Please log in to post a comment
Log in with GitHubJoin 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