I try to create a CSS-only IMG-Tooltip generated from an attribute value. I tried the following code
<img src="blabla.jpg" data-caption="this is my caption" />
and the CSS-Code:
img {
position: relative;
}
img:after {
content: attr(data-caption);
position: absolute;
bottom: 2em;
left: 2em;
z-index: 2
}
Such a way is no problem with div containers. But how can I get this working on images?
Thank you, Thomas