Show Title Tag On Hover Inside Img
Hi I need show a Title tag of img inside img. Like this example http://jsfiddle.net/51csqs0b/ But i don't want use a div before img.
Copy
replace data-content
with title
in css:
.image:before {
content: attr(title);
width:100%;
color:#fff;
z-index:1;
bottom:0;
padding:4px 10px;
text-align:center;
background:red;
box-sizing:border-box;
-moz-box-sizing:border-box;
}
finally, add this jQuery code:
$("a.image").each(function(){$(this).attr('title',$(this).find("img").attr('title'))});
Solution 2:
Here is an easier way. You just use :after pseudoelement on hover. Pure CSS solution
<a href="" class="img"></a>
.img{
display: block;
width:200px;
height:200px;
background: url('http://i.stack.imgur.com/Sjsbh.jpg');
background-size: 200px 200px;
position: relative;
}
.img:hover::after {
content:'This is a description';
position: absolute;
width:100%;
height:20%;
bottom:0; left:0;
background: rgba(255, 255, 255, 0.8);
}
You won't very specific. I hope it will help. You can also make a tooltip.
Post a Comment for "Show Title Tag On Hover Inside Img"