Hi — Anyone know how I can wrap a div around (or position it over) an absolute positioned fluid width/height image. I can't figure it out.
Thanks B.
<div class="wrap">
<img src="http://placekitten.com/g/500/500"/>
</div>
and...
img{
position:absolute;
top:0; bottom:0; left:0; right:0;
max-width:100%;
max-height:100%;
margin:auto;
}
.wrap{
border:5px solid red;
display:block;
}
Here's a: http://jsfiddle.net/20owLkxy/1/
Maybe doing something like this http://jsfiddle.net/20owLkxy/2/
The image will be absolutely positioned inside the wrap with relative position. The other thing you need to do is to give the wrap width and height :)
And if you want fluid image you don't need to position it absolute. Some css will do the trick.
Example http://jsfiddle.net/20owLkxy/4/