Forums

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

Home Forums CSS Changing imgs by “a:hover”. Help!

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #43739
    brunotatsumi
    Participant

    I’m making a new website for a fashion photographer and I’m having some issues with programming the CSS.

    You can inspect at
    http://www.rtakeshi.com

    I think the UX is not so good right now, because you don’t feel like you have to click on the photos to see more.
    The black and white photo is the cover of each editorial. I tried to change the UX, by putting the original color photo while you “a:hover”. Just to make the user realize that he must click on it to see more.

    I made some divs on each photo, and put the “color_photo” on the “background: url()” at the CSS. While you “a:hover”, the img was always changing on the back, not on the front.
    How can I fix this?

    #130080
    NghiQuach
    Participant

    [W3 schools](http://www.w3schools.com/css/css_image_transparency.asp “image opacity”)

    I think this will help you.

    #130088
    CrocoDillon
    Participant

    They are not that bad :P

    You can use both black and white, and color images as a background right?

    a > img {
    url(b&w);
    }

    a:hover > img {
    url(color);
    }

    alternatively, you can just use a color image and use css filters to make it black&white. I’ve seen a cross browser solution not too long ago but didn’t bookmark it. Maybe someone else (or Google) can fill me in :)

    #130089
    CrocoDillon
    Participant

    http://www.karlhorky.com/2012/06/cross-browser-image-grayscale-with-css.html (not the one I was talking about but Google filled me in)

    #130093
    CrocoDillon
    Participant

    Yeah you’re right about w3schools.

    That solution you linked to isn’t Hugo’s own solution, it’s actually from the same link I gave :)

    #130097
    brunotatsumi
    Participant
    #130114
    Kitty Giraudel
    Participant

    Depending on the size of your image, you might want to use a little pseudo-element hack in order to avoid an awkward loadtime when hovering.

    .my-element:after {
    content: ”;
    background: url(my-hover-image);
    clip: rect(0 0 0 0);
    opacity: 0;
    position: absolute;
    }

    #125662
    brunotatsumi
    Participant

    @HugoGiraudel That’s great, man! Thank you so much!

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