html - CSS Background Hover Text -
i have background image getting set opacity 0.3, when hovering, getting set 0.8, seen in css code.
the image code.
<td background="images/1a.png" class="logo" width="160" height="160"> <div class="ch-info"> <h3><br>add new deal</h3> </div> </td>
the css code.
.ch-info { letter-spacing: 2px; font-size: 20px; /* margin: 0 30px; padding: 45px 0 0 0;*/ height: 140px; font-family: 'open sans', arial, sans-serif; -webkit-text-stroke: 1px black; color: #d3d3d3; text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; vertical-align:middle; text-align:center; } .logo { opacity:0.3; filter:alpha(opacity=30); /* ie8 , earlier */ background-repeat:no-repeat; background-position:center; } .logo:hover { opacity:0.8; filter:alpha(opacity=80); /* ie8 , earlier */ background-repeat:no-repeat; background-position:center; }
the text , background hovering effect, want text stay solid, , background hover @ 0.8 when mouse on background , text stay solid regardless if background hovered or not.
as stated in comments, children inherit opacity parent. .ch-info
class inherits opacity .logo
, cannot have immediate parent .logo
.
that being said, have <div class="logo"></div>
before .ch-info
uses position: absolute;
, same height either <td>
or .ch-info
, , has desired background... however, have use position:relative;
on .ch-info
z-index
not become problem.
demo: http://jsfiddle.net/dirtyd77/msg97/3/
html:
<table> <tr> <td width="160" height="160"> <div class="logo" style="background:blue;"></div> <div class="ch-info"> <h3>add new deal</h3> </div> </td> </tr> <tr> <td width="160" height="160"> <div class="logo" style="background:red;"></div> <div class="ch-info"> <h3>add new deal</h3> </div> </td> </tr> <tr> <td width="160" height="160"> <div class="logo" style="background:orange;"></div> <div class="ch-info"> <h3>add new deal</h3> </div> </td> </tr>
css:
.logo { width:160px; height:160px; position:absolute; opacity:0.3; filter:alpha(opacity=30); /* ie8 , earlier */ background-repeat:no-repeat; background-position:center; } .logo:hover { opacity:0.8; filter:alpha(opacity=80); /* ie8 , earlier */ } .ch-info { letter-spacing: 2px; font-size: 20px; /* margin: 0 30px; padding: 45px 0 0 0;*/ font-family: 'open sans', arial, sans-serif; -webkit-text-stroke: 1px black; color: #d3d3d3; text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; vertical-align:middle; text-align:center; position:relative; }
let me know if have questions.
edit: however, situation seems better suited jquery. have provided example below.
Comments
Post a Comment