Design comparison
SolutionDesign
Solution retrospective
Most difficult thing do create was to do (and I failed) change color on hover on buttons and letters inside buttons. I think I am missing out something here. It shouldn't be that complicated, I think. :D
Community feedback
- @msunjiPosted over 2 years ago
Hiya Dean! Great job! 👍
You're right about it not having to be too complicated. Here's how to simplify things a bit. First off, I noticed you used
id
's, you can use classes instead. The logic here is:- Aside from the text colour, your buttons all have the same base style - the same size, padding, etc. You can use the
button
selector, or make a class that you'll use for all three buttons. (Note: in this explanation, I'll use thebutton
selector instead of a class, but you can definitely have two or more classes for an element). - Set your base styles. You'll also want to set a border that's the same colour as the button's background colour, so something like:
border: 2px solid #fff;
- To change the button's colour on hover, instead of setting the background colour for each button, you can do this instead:
button:hover { background: transparent; color: #fff; }
- Last but not least, to change the text colour for each button, you'll want to make a class for each button. Maybe something like
button-sedan
,button-suv
, etc. Then for each class, set the colour accordingly.
That should help reduce/simplify the amount of CSS you've written. Hope you find this helpful!
Marked as helpful1 - Aside from the text colour, your buttons all have the same base style - the same size, padding, etc. You can use the
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