Responsive interactive rating page using HTML, CSS amd pure JavaScript
Design comparison
Solution retrospective
I'm a novice developer, and I'd like to know where I went wrong in the best practices, and how I can further refactor my JavaScript. I thank!
Community feedback
- @correlucasPosted about 2 years ago
👾Hello Matheus Saggiorato, Congratulations on completing this challenge!
Here's two tips for you:
To improve the card overall responsibility, you can start to add
flex-wrap
inside the class that manage the section for therating numbers button
and make the adjust to fit in different rows while the container scales down, not that without this property the container doesn't shrink. Here's the code applying these changes:.buttons-group { justify-content: center; display: flex; gap: 20px; flex-wrap: wrap; }
Fix the alignment of the whole content using
flex
andmin-height
to manage the vertical alignment and make everything centered.First of all putmin-height: 100vh
to thebody
to make the body display 100% of the viewport height (this makes the container align to the height size that's now 100% of the screen height) size anddisplay: flex
eflex-direction: column
to align the child element (the container) vertically using the body as reference.body { min-height: 100vh; background-color: hsl(216, 12%, 8%); display: flex; flex-direction: column; align-items: center; justify-content: center; }
✌️ I hope this helps you and happy coding!
Marked as helpful0@MatheusSaggioratoPosted about 2 years agoOlá @correlucas. Excelente melhoria com o flex-wrap, ficou muito mais responsivo, agradeço muito!
1 - @hyrongennikePosted about 2 years ago
Hi @MatheusSaggiorato,
Nice job on the challenge
You can add the following or make changes to your CSS rules it just to position the card in the middle of the page.
body { background-color: hsl(216, 12%, 8%); display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; } #container { margin: 0 0 2rem; }
I would suggest removing any browser alert boxes it's bad for user experience, you can add the disabled attribute to the button and when a rating is selected remove the attribute it implies the same thing to the user that a rating needs to be selected.
Hope this is helpful.
Marked as helpful0@MatheusSaggioratoPosted about 2 years agoHi @hyrongennike. Thank you very much for the suggestions for improvement, I will increase them in my project.
0
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