I have used the content attribute for a long time, and today I wanted to try something new. Instead of using JS to display a image tooltip I wanted to know if it was possible to do it dynamically with CSS.
So I tried:
.TableLine:hover:after{
content: url("../Img/Photo/"attr(id)".jpg");
}
where attr(id)
is supposed to return the ID of the picture (alphanumeric) which is also the name of the picture.
It doesn't work at all, it has no effect. I think that the block did not parse because adding a border or background to the block also seems to have no effect.
When I just use the attr(id)
alone, without the url thing, it works perfectly. It also works when I replace attr(id)
with the real name of the picture.
After searching a while on the web I haven't found anything relevant so here I am. Is that a known bug or just my mistake? :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…