http://jsfiddle.net/ZSZQK/
#hover { display: none; } #image:hover + #hover { display: block; }
Just make it simple, no need to change the markup.
Update
If you want to change the opacity of the image on hover, then http://jsfiddle.net/ZSZQK/4/
#hover { display: none; position: relative; top: -25px; } #image:hover { opacity: .7; } #image:hover + #hover { display: block; }
Update 2
Since you added a couple more requirements to your original question, now this requires changing the original html markup.
I assume that you are using html5 , and if so, you should use tags assigned to your content context:
<figure> <img src="http://placekitten.com/200/100" /> <figcaption>Test message</figcaption> </figure>
and css
figure { position: relative; display: inline-block; } figcaption { display: none; position: absolute; left: 0; bottom: 5px; right: 0; background-color: rgba(0,0,0,.15); } figure:hover img { opacity: .7; } figure:hover figcaption { display: block; }
jsFiddle
Jose Rui Santos
source share