I'm trying to attach an "information div" to the left bottom edge of a fullscreen/centered/fitted image.
The image has to fit into the screen size (just like css property object-fit: contain
does) and the information div should be attached to the bottom left side of the image.
Here is my css try (not even close) and here are three images to describe the wanted behavior!
Note: I'm looking for a CSS-only solution, so, please, no JS!
Edit: Attach div to a fullscreen image to the corner of another div with no predefined size / fullscreen.
* {
margin: 0;
padding: 0;
}
#out {
}
#in {
}
#info {
background-color: red;
color: white;
display: inline-block;
position: absolute;
bottom: 10px;
left: 10px;
}
img {
width: 100vw;
height: 100vh;
object-fit: contain;
}
<div id="out">
<div id="in">
<img src="https://images.unsplash.com/photo-1501630834273-4b5604d2ee31?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80" alt="">
<div id="info">This is the image info!</div>
</div>
</div>