I’m having some difficulty with this example:
<img src="image1/<?php echo $file; ?>.jpg" style="width:500px" />
<p id="caption"><?php echo $caption; ?></p>
I’m trying to get the caption with CSS when hovering the image.
I tried to use a img{hover;} and p {hover;}.
Is there a way for me to get the caption when hovering the image? The example is in PHP and if it was in CSS or Javascript maybe I could search for it, but so far I can’t find a solution for this.
I appreciate any explanation & examples.
jsFiddle Demo
+is the Adjacent Sibling Selector, supported from IE8.:hoverpseudoclass is used to style elements the mouse goes overIf you need something that works in IE7, consider HTML like this:
And the CSS would be:
jsFiddle Demo