Design comparison
Community feedback
- @zanfa97Posted 3 months ago
Great job, you can use [Custom properties] (https://css-tricks.com/a-complete-guide-to-custom-properties/) to store colors in variables in order to reuse them without rewriting them every time.
Marked as helpful0@A-noob-in-CodingPosted 3 months ago@zanfa97 To add up, the syntax of using custom properties or variables in common languages in CSS is:
--YourVariableName : ItsValue
The variables are assigned in root scope of css that is:
:root { all variables goes in here }
For example, lets suppose you want to store a color which is provided as a hsl or rgb value, in a variable because it is a such a hassle to write the color codes for the color over and over again, then it could look like this:
--GrayColor : rgb(128,128,128);
Now you can use this gray color as:
color : var(--GrayColor);
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin 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