I am facing an issue on my website where I need to create <div>
elements that expand to display images and a title. My current approach involves a structure like this:
<div class="thumb">
<img src="image_url"/>
<div id="title">title</div>
</div>
and the title is positioned using the following CSS:
#title{
position: absolute;
bottom: 0;
left: 0;
}
However, the title <div>
ends up below the image. I attempted adjusting the line-height
property within the div, which solved the issue of text spilling over the image but caused problems with text padding. Is there a better way to correctly position the title at the bottom right corner of the image?
For reference, here is a link to a jsfiddle illustrating the problem: