Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Overlay Effect on Image

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #281343
    OfficerHTML
    Participant

    Can’t seem to have much luck trying to get this overlay effect on my image. I have pretty much copy and pasted from the overlay example from W3S website, but still doesn’t seem to work.

    HTML:

    <div class="my-wrapper">
            <img class="img-fluid" ID="preview" src="images/film.jpg" alt="film">
            </div>
    

    CSS:

    .img-fluid {
        border-bottom: 5px solid red; 
        border-left: 5px solid black; 
        border-right: 5px solid black; 
        border-top: 5px solid black;
    }
    
    /* Transition */
    
    .img-fluid {
      opacity: 1;
      display: block;
      width: 100%;
      height: auto;
      transition: .5s ease;
      backface-visibility: hidden;
    }
    
    .my-wrapper:hover .img-fluid {
      opacity: 0.3;
    }
    
    #281357
    Shikkediel
    Participant

    Please elaborate on “it doesn’t work” because the code seems to be fine in itself. Preferably add a working demo in Codepen as well.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.