HTML CSS examples for CSS Widget:Hover Image
display text over a faded image on hover
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .wrapper {<!-- w w w . j av a 2s.co m--> position:relative; padding:0; width:100px; display:block; } .text { position:absolute; top:0; color:Chartreuse; background-color:yellow; width:100px; height:100px; line-height:100px; text-align:center; z-index:11; opacity:0; -webkit-transition:all 0.6s ease; -moz-transition:all 0.6s ease; -o-transition:all 0.6s ease; transition:all 0.6s ease; } .text:hover { opacity:2; } img { z-index:2; } </style> </head> <body> <a href="#" class="wrapper"> <span class="text">Lore</span> <img src="https://www.java2s.com/style/demo/Opera.png"> </a> </body> </html>