When I hover a .tags
I'd like to show the image https://mal-stats.glitch.me/tagslegend.png next to it.
Test it out on this page.
I'd like to see this when not hovering .tags
(all the cells in that final column have tags
class):
and this while hovering the first .tags
cell:
The image should align with the cell that is being hovered.
I know how I would do this with javascript. I also know how I could do this if I could change the html.
Because it's a user-stylesheet though I can only use CSS.
How do I do this in pure CSS?
I'm assuming I'd have to use pseudo-elements somehow, but I don't have enough experience to even know where to begin.
This is basically where I'm at:
.tags:hover:after {
background-image: url(https://mal-stats.glitch.me/tagslegend.png);
}
but it doesn't work. I've seen examples that set display: block
and then width
and height
, but the image from /tagslegend.png is dynamic. If that's a huge problem I can change that, but a solution that works with any widths and heights is best.
The code will need to run on this page, but b/c it's been requested in comments here's a minimal example:
.tags:hover:after {
background-image: url(https://mal-stats.glitch.me/tagslegend.png);
}
<table>
<tr>
<td>Foo</td>
<td>Bar</td>
<td>Baz</td>
<td class="tags">Hover me</td>
</tr>
</table>