• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

CSS How to make hover text appear exclusive to the image being hovered on (In cargo.site)

Emilyperelman

New Coder
Hello! I'm a bit of a newbie to HTML & CSS so I'd appreciate all the help I can get. I'm currently building a website on Cargo and have customized the CSS so that image captions appear when an image is hovered on. The issue I'm having is that when I hover on an image, the caption for that image appears, but so does the caption for every single other image in the gallery. I would like so that when an image is hovered on, only that images caption will appear and the others will stay invisible. Looking forward to hearing any advice!

CSS:
.gallery_image_caption {
    background: rgba(255, 255, 255, );
    padding: 0.5rem 1.2rem 0.7rem 1.2rem;
    margin: 2.4rem;
    color: rgba(255, 255, 255, 1);
    align-content: center;
    font-family: "Space Mono";
    position: absolute;
    left: 0;
    bottom: -0px;
    z-index: 9;
    opacity: 0;
    transition: opacity .3s ease-in-out;
    font-style: normal;
    font-weight: 500;
    font-size: 30px;
}


.content:hover .gallery_image_caption{
    opacity: 1;
  }
 

Emilyperelman

New Coder
Yes! Unfortunately cargo doesn't let me see the whole HTML but here are the bits it shows.

HTML:
<div class="thumbnail_sizer">
<a class="gallery_card has_caption">
<div class="gallery_card_image">
<img>

Code:
<div class="image-gallery" gid="4">
<a rel="history" href="Amplifier" class="image-link">{image 3 no-zoom="true" caption="xs"}</a>
<a rel="history" href="Amplifier" class="image-link">{image 1 caption="NEWPORT BLEACH"}</a>
{image 6 caption="sssss"}
{image 15 caption="RISOGRAPH"}
</div>
 

cbreemer

King Coder
The HTML does not seem to correspond to the CSS in any way ! Also, the second HTML looks weird to me, with that stuff between curly braces. It this some special syntax ? I think you'll need to isolate the issue in a complete HTML page with complete CSS. Just some fragments will not do. Keep in mind there could be multiple CSS sheets at work. You'll also need to specify which caption is invading all the other images it was not meant for.

BTW - How can you even work on a website if you don't have access to all the code ?
 
Top