I am trying to customize the CSS of a course website in which I cannot use javascript or change the HTML - I can only upload custom CSS files.
I have made it so, in a list of content links to .jpg files, when I hover over the list item, the corresponding image appears underneath. I have got the hover function to work but it requires me to make a new class selector for every file in the list.
The code that shows the image on hover is:
.itemlink:hover:after {
content: url([image url]);
display: block;
position: relative;
zoom: 50%;
}
The image files are linked in this way.
Is there a way for me to set a variable called "--assetPath" that refers to whatever link is present in the href for the "link-div-head" class in the attached image, so I can place that variable as the content url for the hover effect?
Alternatively, could I set it up so the url is a variable that is set to return the url of an image file if given the file name (ie. the text in the "link-text itemtext" class below the highlighted part in the attached image)?
Basically, is there a way for me to set this up so that the image url is automatically the image that I am hovering on, so I don't have to link each individual file.
I'm fairly new to css so I hope this makes sense. I can provide extra clarification if necessary. Thanks.