0

I have used content tag in css for the on hover function as I have given an id to the image tag.But, the on Hover is not working in Firefox and IE and it's working fine in chrome. Here is the link to this : thunderstorm999.byethost9.com

#explore:hover {
    content: url('images/explore-hover.png');
}
#material:hover {
    content: url('images/material-hover.png');
}
#team:hover {
    content: url('images/team-hover.png');
}
#contact:hover {
    content: url('images/contact-hover.png');
}
#merchandise:hover {
    content: url('images/merchandise-hover.png');
}
<ul class="navigation">
<li><a href="#"><img id="explore" src="images\explore.png"/></a></li>
<li><a href="#"><img id="material" src="images\material.png"/></a></li>
<li><a href="#"><img id="team" src="images\team.png"/></a></li>
<li><a href="#"><img id="contact" src="images\contact.png"/></a></li>
<li><a href="#"><img id="merchandise" src="images\merchandise.png"/></a></li>
</ul>
user1538020
  • 515
  • 1
  • 9
  • 25
  • 1
    `img` can't have content. So behavior of Firefox and IE is correct. Use content of `a` tag instead and set image as background. – dfsq Feb 15 '15 at 09:08
  • Didn't get you. Can you please give an example using the above code? – user1538020 Feb 15 '15 at 09:12

1 Answers1

1

According to mozilla and w3c the css content property is supposed to work only in conjunction with the :before and :after pseudo-elements. So it's better not to use it in the present case. You can do it instead like this.

<li id="explore">&nbsp</li>

#explore {
background: url('http://thunderstorm999.byethost9.com/images/explore.png') center no-repeat;
}

#explore:hover {
background: url('http://thunderstorm999.byethost9.com/images/explore-hover.png') center no-repeat;
}
Ram Tobolski
  • 346
  • 1
  • 9