html - How to bring an image appear on an image on-hover using sprites -
i trying make line appear(say 10px) after hovering mouse on image @ bottom of image
i saw on mtv's website in "you these" section below every post.they use css-background sprites that.
i going mad after repeated failed attempts recreate.everythings works,except main onhover line coming up. code far
css
.yel_strip{background-position:-280px -495px; width:165px; margin:-8px 0 0 0; height:5px; position:absolute; display:none; z-index:1;} .yel_strip:hover{ background:url(http://mtv.in.com/images/sprite_v1.png) no-repeat;}
html
<div class="moviel hover_thumb"> <div><a href=""><img width="165" height="93" alt="" src=""/></a> <div class="yel_strip"></div> </div> </div>
any appreciated.thanks
i've made working fiddle no not needed markup in html: http://jsfiddle.net/pjmpw/3/
your html:
<a href="#" class="hoverable"> <img src="http://placekitten.com/g/300/300" /> </a>
and css:
.hoverable { display: block; position: relative; width: 300px; height: 300px; overflow: hidden; } .hoverable:hover:after { bottom: 0; } .hoverable:after { content: ""; position: absolute; width: 100%; height: 10px; bottom: -10px; left: 0; background: -moz-linear-gradient(left, rgba(46,170,232,1) 0%, rgba(255,235,137,1) 100%); background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(46,170,232,1)), color-stop(100%,rgba(255,235,137,1))); background: -webkit-linear-gradient(left, rgba(46,170,232,1) 0%,rgba(255,235,137,1) 100%); background: -o-linear-gradient(left, rgba(46,170,232,1) 0%,rgba(255,235,137,1) 100%); background: -ms-linear-gradient(left, rgba(46,170,232,1) 0%,rgba(255,235,137,1) 100%); background: linear-gradient(to right, rgba(46,170,232,1) 0%,rgba(255,235,137,1) 100%); -webkit-transition: 0.2s ease-in-out; transition: 0.2s ease-in-out; }
Comments
Post a Comment