Design comparison
Solution retrospective
I tried to use the DRY Principle with the Buttons but the text color was different.
Would there be a way to inherit the background color as the font color?
Community feedback
- @arfernnPosted about 1 year ago
I see what you mean with your question. However I think sometimes it's better to not to take things to the limit. It is good that you try to not to repeat the same color multiple times, but this is precisely why you made it a variable, to be able to reuse the actual value in multiple places. And if you change the value, you have to change it only in one place.
background-color can be inherited if you add in the children background-color: inherit. But you can't use the inherited value to assign it to a color property, as far as I can tell.
Marked as helpful1@SaitenhexerPosted about 1 year ago@arfernn
Yes, that's a good point with the variable.
It just stood out to me like "why write something 3x".. but you're correct with not always taking things to the limit.
Thank you :)
0
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