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

Score summary page

@HonkyTonkTP

Desktop design screenshot for the Results summary component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Any tips on how to try and cut down on how much I have to repeat my css? I tried not doing it too much but I still feel there's quite a bit of repeating stuff in there. Thanks

Community feedback

P
markus 1,940

@markuslewin

Posted

If multiple classes use the same properties, you could move those properties into a new class and apply both classes to the element, like you did with .border-radius!

Some examples:

.stack {
  display: flex;
  flex-direction: column;
}

/* properties can be removed from `body`, `.score`, `.result`, `.summary`, `.summary-list` */
.icon::before {
  content: "";
  position: absolute;
  top: 30%;
  left: 5%;
  width: var(--icon-width);
  height: var(--icon-height);
  z-index: 9;
}

.reaction::before {
  background-image: url(./assets/images/icon-reaction.svg);
}

/* using variables: */

.icon::before {
  content: "";
  position: absolute;
  top: 30%;
  left: 5%;
  width: var(--icon-width);
  height: var(--icon-height);
  z-index: 9;
  background-image: var(--icon-image);
}

.reaction::before {
  --icon-image: url(./assets/images/icon-reaction.svg);
}

Marked as helpful

1

@HonkyTonkTP

Posted

@markuslewin Oh, thanks for the example, I will use that in the future. Still new to using variables, I keep forgetting that you can actually change them after they've been set once.

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