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

Interactive-rating-components challenge HTML CSS JS

@NataliaDeJager

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


Hey there! Here's my solution to the challenge c:

Is there a way to write the background-color in css that is written with HSLA, using the :root variables but also adding the given opacity to that color?

Any help/feedback is appreciated!

Community feedback

P
teempe 590

@teempe

Posted

Hi :) I do not think you could change alpha for once defined color. You can manipulate with custom values of opacity, but you need to define your variables as values passed to hsl() function. See example below.

:root {
  --bg-color: 0, 0%, 0%;
  --opacity: 50%;
}

div {
  background-color: hsla(var(--bg-color), var(--opacity));
}

Hope it helps... a bit at least ;)

Marked as helpful

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