Design comparison
Solution retrospective
Overall I didn't find this project too difficult, but weirdly, out of everything, the one thing that gave me a slight-headache, was trying to figure out how to turn the social media icons from green to white on hover.
I thought it would work with simple CSS, but nope, that apparently won't work in Firefox or Chrome, so I had to do what might be considered to be quite 'hacky' and have more than one set of icons in different colours and use z-index to hide the green on hover.
This challenge looks quite basic to look at, but definitely quite a challenge for a beginner.
Community feedback
- @CorinaMurgPosted over 1 year ago
@KayGeorgeson
Hi Kay, I had a hard time as well figuring out how to change the color on hover for the svg elements.
I don't know much React, but this is what worked for me in JS (similar to what @FloRiouffreyt suggested):
- go to the svg file. In the <path> element, change fill="current color";
- with css set svg { color: white; } and svg:hover { color: green; }.
This does require that you use <svg> and not <img> in your html (at least, I wasn't able to get it to work with <img>). Hope this helps a bit! Corina
Marked as helpful1@KayGeorgesonPosted over 1 year ago@Cor-Ina Hi yes I thought there must have been an easier way than my hacky way haha I'm going to play about with both solutions given to see if I can make them work in Chrome. Thank you!
0 - @FloRiouffreytPosted over 1 year ago
It's definitely possible to do the color change with CSS, by using directly the <svg> and not an <img> tag. Feel free to check to way I did it, it works perfectly fine.
Import the <svg>, add the "fill" attribute with the default green color on it, and then in CSS, locate your svg and create the hover rule.
It's even better to put the <svg> inside an element which will be the one pointed by the hover. If you hover an SVG, every part that is not filled will not be considered "hovered" (like the hollow part of the F of Facebook for example".
If you put it inside an <ul> then each <svg> in <li>, give a common class to all your <li>, and in CSS, simply add " .your-li-class:hover > svg { fill:#yourcolor }. Hope this helps!
Marked as helpful0@KayGeorgesonPosted over 1 year ago@FloRiouffreyt Thank you! I'm going to play around with this solution and see if I can get it to work :)
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