Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Responsive ratings component using HTML/CSS media queries + JavaScript

@elizabethrsotomayor

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


For some reason, the CSS that I applied for the submit button did not appear on mobile. The padding property did not change anything, but I was able to change the background color. I found the form handling to be a challenge as I did not know whether to include a form action or what that action would have been. I am also unsure of my use of relative and absolute positioning to center the card on the page. Thank you for looking!

Community feedback

@VCarames

Posted

Hey there! 👋 Here are some suggestions to help improve your code:

  • The “icons/illustrations” in this component serve no other purpose than to be decorative; Their alt tag should be left blank and have an aria-hidden=“true” to hide them from assistive technology.

More Info:📚

https://www.w3.org/WAI/tutorials/images/

  • Your form is lacking a visually hidden legend for accessibility and a fieldset to prevent users from selecting more than one rating.

More Info:📚

MDN <input type="radio">

MDN <fieldset>: The Field Set element

  • Do not forget to update your code with the errors the FEM report found.
  • A lot of the headaches and repeated properties can be be overcome by implementing a proper CSS Reset.

Here are few CSS Resets that you can look at and use to create your own or just copy and paste one that is already prebuilt.

https://www.joshwcomeau.com/css/custom-css-reset/

https://meyerweb.com/eric/tools/css/reset/

http://html5doctor.com/html-5-reset-stylesheet/

If you have any questions or need further clarification, feel free to reach out to me.

Happy Coding!🎄🎁

Marked as helpful

1

@dylan-dot-c

Posted

Here are 2 easy ways to center anything without using relative/absolute

  1. CSS Flex .container { display: flex; align-items: center;/vertivally/ justify-content: center;/horizontally/ }

  2. CSS GRID

.container { display: grid; place-items: center; }

I saw that you used flexbox already so this should be clear to you. XD

Marked as helpful

1

@elizabethrsotomayor

Posted

@dylan-dot-c Thanks, I should have been more clear with my question. I already know that stuff about grid/flexbox but didn’t know if relative/absolute positioning to center my card would be considered a bad practice or not. I guess your response answered that question too! Thanks again.

1

@VCarames

Posted

@elizabethrsotomayor

It’s an outdated method, and for the purpose you’re using it for. It is still useful for other things, like positioning a nav hamburger button, placing an illustration in a certain unique manner, etc…

Marked as helpful

1

Please log in to post a comment

Log in with GitHub
Discord logo

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