Design comparison
Solution retrospective
is there a cleaner way to adjust the color of the button text, while hovering over, to match the background color?
Community feedback
- @AmodeusRPosted about 2 years ago
Since the hover effect is the same on every button, you could just use a common class among them and apply the desired effects. When it comes to the background, just use the alpha channel to make it transparent, thus not needing to specify background colors for the buttons whilst being able to use it anywhere without worries about the background.
How to use the alpha channel? The alpha channel is the fourth parameter in the colors. There are plenty of ways of writing it, for example:
rgba(30, 30, 250, 0.5) hsla(200, 80%, 50%, 0.5)
This "0.5" is the alpha channel which will make it transparent. There are many other ways of using the alpha channel, even with regular rgb/hsl. You can learn more about them through these links:
https://www.w3schools.com/css/css3_colors.asp#:~:text=RGBA%20color%20values%20are%20an,and%201.0%20(fully%20opaque). https://developer.mozilla.org/en-US/docs/Web/CSS/alpha-value
Also, you should add the cursor: pointer to your mouse when hovering interactable elements on your page to make the user experience better.
1
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