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

I used html css and javaScript to complete the challenge

Breia 50

@BreiaJohn

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

Prantik 660

@prantiknoor

Posted

Your solution is pretty well 😊. I learned some new things from that.

But I found there something that can be improved.

First you can use CSS variables. It will make easier to control your code. as example:

:root {
  --text-color: hsl(217, 12%, 63%);
  --gradient-background: linear-gradient(hsl(213, 19%, 18%), hsl(216, 12%, 8%));
}

/* then you can use like this */
.rating-card {
  color: var(--text-color)
}

Secondly, there is code duplication. you used many common property in both .rating-card & .thank-you-car.

.rating-card {
  /* These are common properties */
  background: linear-gradient(hsl(213, 19%, 18%), hsl(216, 12%, 8%));
  color: hsl(217, 12%, 63%);
  height: 360px;
  width: 400px;
  padding: 20px;
  border-radius: 15px;
}
.thank-you-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* These are common properties */
  background: linear-gradient(hsl(213, 19%, 18%), hsl(216, 12%, 8%));
  color: hsl(217, 12%, 63%);
  height: 360px;
  width: 400px;
  padding: 20px;
  border-radius: 15px;
}

You could create a class like .card with those common properties:

.card {
  background: linear-gradient(hsl(213, 19%, 18%), hsl(216, 12%, 8%));
  color: hsl(217, 12%, 63%);
  height: 360px;
  width: 400px;
  padding: 20px;
  border-radius: 15px;
}

Now you can use the .card class & avoid code duplication. as example:

<div class="container">
<div class="card rating-card">
    ...
  </div>
<div class="card thank-you-card hidden">
    ...
  </div>
</div>
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