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 Page by Srinath

@SrinathKadam048

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


What are you most proud of, and what would you do differently next time?

Very proud that I can complete this project. Not to the flawless extent, but very happy that I am better than what I was yesterday with understanding the flexbox and new JS concepts.

What challenges did you encounter, and how did you overcome them?

Responsive design is always a challenge to me and a topic which I tend to skip always

What specific areas of your project would you like help with?

Responsive Design. Not sure if the widths, margins, etc should be in % or vh or rem or px. Also, need help with simplifying media queries

Community feedback

P
Patrycja 160

@Patrycja-dz

Posted

Hey there! Great to see your progress with JavaScript and flexbox. It's evident that you're enjoying what you're doing, which is crucial for staying motivated and productive! 😊

Regarding your question about units in CSS, it's essential to understand that the choice of units often depends on various factors such as project requirements, design considerations, and personal preferences. Here's a breakdown of when to use different units:

Percentages (%):
    Ideal for creating fluid layouts that adapt to different screen sizes.
    Useful for specifying widths relative to the size of the parent container.
    Ensures elements scale proportionally when the parent container's dimensions change.

Viewport Height (vh):
    Useful for elements that need to span a specific percentage of the viewport height.
    Often used for full-screen sections, hero images, or elements that should always fill the screen vertically.
    Provides consistency across different screen sizes.

Root Em (rem):
    Recommended for setting font sizes and spacing.
    Offers scalability and consistency, as rem units are relative to the root element's font size.
    Simplifies adjustments to font sizes and spacing by changing the root font size.

Pixels (px):
    Provides precise control over element dimensions and spacing.
    Useful for fixed-size elements or when specific pixel measurements are required.
    Less flexible for responsive design compared to percentage-based or relative units.

For further insights into CSS and units, I recommend checking out Kevin Powell's YouTube channel. He provides excellent explanations, especially regarding the tricky parts of CSS and units.

Regarding your CSS file, I noticed that the same percentage value appears in several places. Consider storing it as a custom CSS variable to enhance maintainability and consistency across your stylesheets.

As for media queries, while you mentioned that you don't need media queries for this small UI component, I typically use them as an extension beyond the mobile version. Here's a breakdown of how I approach it:

Base Styles for Mobile:
    Everything defined before the media query can be considered as styles for the mobile version.
    These styles cater to smaller screens and ensure that the component looks good on devices like smartphones.

Media Queries for Larger Screens:
    Within the media query, I define styles for small tablets, tablets, and desktops.
    This allows me to adjust the layout and appearance of the component to fit larger screens appropriately.
    It's essential to consider the design and extend the styles to ensure a seamless user experience across various devices.

Lastly, regarding JavaScript, consider using let instead of var to avoid creating global variables in the window object. This helps keep your code encapsulated and prevents unintended access to variables by other scripts.

Remember, if comments are unnecessary, feel free to remove them to keep your code clean and concise.

0

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