• 0

images a:hover


Question

i resize some images on my blog to fit the theme, so i have decided to make a dark, transparent overlay on the image that says "click to enlarge" whenever the mouse hovers over the image

i have the png for the overlay ready, but im not sure how you would code that in css,

and all my images are under the class ".postimage"

so i was thinking something about .postimage a:hover?

thanks!

Link to comment
https://www.neowin.net/forum/topic/713204-images-ahover/
Share on other sites

7 answers to this question

Recommended Posts

  • 0

My guess since it is a class and assuming it is under an id "main" (I never used word press so I'm just making up a random id) and if the class is part of an img. I would say try "#main img..portimage:hover". That extra dot in front of portimage just makes it look odd. Or you could try, "img..portimage:hover".

Link to comment
https://www.neowin.net/forum/topic/713204-images-ahover/#findComment-590319036
Share on other sites

  • 0

First :hover will work only for a in IE6. In other browsers including ie7 it works for all elements. The best way to do what you are after is to enclose the image and a span for the overlay inside a as show below.

<a class="gallery" href=""><span class="overlay"></span><img src="" /></a>

The css...

a.gallery, a.gallery:visited {
width: (width of image);
height: (height of image);
display: block;
position: relative;
}
a.gallery, a.gallery:visited img {
display: block;
}
span.overlay {
top: 0;
left: 0;
height: (height of overlay image);
width: (width of overlay image);
display: block;
position: absolute;
margin-left: -9000px;
background: (set overlay image as background);
}
a.gallery:hover span.overlay {
margin: 0;
}

Link to comment
https://www.neowin.net/forum/topic/713204-images-ahover/#findComment-590333376
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • $80 or 90%, anything else would be financial suicide one way or another.
    • Or... just use Bitwarden. Free, and has on-prem option as well. Works both on desktop and mobile, wherever you are. The age of local password files is over.
    • Thanks
    • I actually got to use one of those so called "backup codes" once. It was for a customer, I choose the backup code option, and by the grace of god, they actually hade them printed out. Imagine my surprise, when after using the backup code, Google then told use we had to enter a code they just sent to the gmail address we currently did not have access to. I was not amused, Google backup codes should be the end all get out of jail free card, because you had to have access to the account to even get them.
    • On the topic of being locked out of a service. Recently two different friends of mine got locked out of their Google accounts. Both were hack attempts and one of them is waiting 30 days before he can get back in. He had backup codes and MFA but not a passkey. It was a browser token hack. Anyhow he has to wait 30 days for the dispute or whatever to end. The other person only had a password and is screwed losing all of the email, docs and years of photos. Google won’t help her at all. Her fault because she had no backup/recovery setup. Enable passkeys if possible. Also do NOT use browser based password managers. If using a cloud service make sure it is one you can fully sync to one of your devices so you can back it up. Like a PC or Mac with some backup drive plugged into it. Google is the worst to use IMHO. You can’t sync your photos at all. You have to use the “Take Out” service which is manual and takes days. That service strips the meta data from your photos. Also Google Docs synced to a device are useless without a Google accounts. MS Office/Libre Office is not going to open a link to a Google doc to a dead account.
  • Recent Achievements

    • Week One Done
      Supreme Spray LV earned a badge
      Week One Done
    • One Month Later
      Genuinetonerink- Dubai earned a badge
      One Month Later
    • Week One Done
      Genuinetonerink- Dubai earned a badge
      Week One Done
    • One Year In
      hhgygy earned a badge
      One Year In
    • Week One Done
      AMV earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      513
    2. 2
      +Edouard
      164
    3. 3
      PsYcHoKiLLa
      88
    4. 4
      Steven P.
      74
    5. 5
      Michael Scrip
      73
  • Tell a friend

    Love Neowin? Tell a friend!