I've been utilizing the content attribute for quite some time now, but today I decided to explore something different. Instead of relying on JS to show an image tooltip, I was curious if it could be done dynamically using CSS.
So I attempted the following:
.TableLine:hover:after{
content: url("../Img/Photo/"attr(id)".jpg");
}
where attr(id)
is meant to output the alphanumeric ID (which is also the picture's name).
However, this method didn't produce any results - it simply did not work. It seems like the block wasn't parsing correctly as adding a border or background had no effect either.
Interestingly, when I used just attr(id)
on its own without the URL component, everything functioned perfectly. Additionally, replacing attr(id)
with the actual picture name also worked flawlessly.
After scouring the web for answers, I couldn't find anything relevant, so here I am. Is this a known bug or simply my mistake? :)