Hi,
I’m trying to make the CodeCamp Tribute page, can you help me figure out why is my #image-4:hover not working?
I want it to switch to the other image when hovered . But using CSS instead of HTML onmouseover.
why is it not working?
There’s a link to my pen .
Thank you.
ok, so here is what’s happening:
you have an img element with a src pointing to an img
that displays the image on your webpage
great! that works as expected
then in your css you set a background img
but your img tag already has a src
so it doesn’t display
the best way to do this without JS is
- create a container div that is the size you want to display your img (you will have to give it width and height bc it will not actually have any content
- do not put an img element in the container div
- in your css, give the container div a background img
- in your css, set the new bg img on hover
hope that helps!
1 Like
YES!!! OHMYDAYS!!! IT WORKS.
Thank you so much.
1 Like