So i have an IMG that i want to have a full cover caption on when hovering and my code looks like this ATM:
<div class="box">
<img src="#" />
<span class="caption">hello</span>
</div>
.box{
position: relative;
overflow: hidden;
height: 200px;
width: 200px;
}
img{
position: absolute;
left: 0;
height: 200px;
width: 200px;
}
.caption{
position: absolute;
opacity: 0;
background: #000;
height: 200px;
width: 200px;
}
.caption:hover{
opacity: 0.7;
}
And this is working, but the thing is i dont want the widht and height to be static, i want it to depend on the size of the image, and the img actual size is % based as it is a responsive design. Maby its easy but my brain doesnt seem to work atm.