Reputation: 3971
Here is the code - div and imgage in it - on hover apears another div with text. So the question is - how to make a link over this div (imgWrap) or (imgDescription) with text? I want the whole div to be a link, but all my efforts ended with nothing. Thanks
link http://jsfiddle.net/6Dupu/
<style>
.wr{
border:1px solid #ccc;
margin:10px;
float:left;
}
.imgWrap {
position: relative;
height: 175px;
width: 250px;
}
.imgWrap img{
height: 175px;
width: 250px;
}
.imgDescription {
position: absolute;
padding:20px;
overflow:hidden;
top: 0;
bottom: 0;
left: 0;
right: 0;
height:100%;
line-height:14px;
background: rgba(29, 106, 154, 0.8);
color: #fff;
visibility: hidden;
opacity: 0;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
}
.imgWrap:hover .imgDescription {
visibility: visible;
opacity: 1;
}
</style>
<div class="wr">
<div class="imgWrap">
<img src="somepic">
<p class="imgDescription">
<a href="" style="color:white;"><b>item_name</b></a>
<small style="display:block;padding:10px 0px;">item_text</small>
<small>item_date</small>
</p>
</div>
</div>
Upvotes: 0
Views: 170
Reputation: 5260
<a href=""><div class="wr">
<div class="imgWrap">
<img src="somepic"/>
<p class="imgDescription">
style="color:white;"><b>item_name</b>
<small style="display:block;padding:10px 0px;">item_text</small>
<small>item_date</small>
</p>
</div>
</div>
</a>
And in your style set .imgDescription{marging:0px}- because in Firefox I see that "p" have some marge
Upvotes: 1
Reputation: 1584
Instead of showing a div with text when you hover the first div, use an anchor and use it as block. (display: block)
Upvotes: 3