• 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

    • Population especially in high density areas creates more heat and more humidity. This can be noticed in an indoor arena or concert room which heats up when the room or arena fills with people, without air conditoning to cool it down, Watering of lawns creates more humidity as the moisture from the watering rises into the atmosphere, creating a more humid condition. The again, depopulating an arena or room after an event will drop the temperature inside. Desert areas are less humid for a number of reasons, including a lower population density. Tel Aviv has horrible weather, unless you like it hot and humid. Summer days are regularly 90+ F with humidity well over 70%. It is probably not as bad as Mississippi but still it is bad enough.
    • Where is the "Wow!" emoji? This'll have to do 🤩
    • I hear you on browser password manager, in my case I have two Google profiles, one was created when Google decided to grandfather us out of Workspace for Domains (with the replacement being too expensive for 25 users) resulting in my domain email address no longer being able to be registered to a new Workspace I created (for myself and another co-owner) so I could use Takeout and sync over some stuff to the new Workspace. Then I have my personal Google profile which I could be logged into on my desktop or Mobile, so I am saving passwords on one or the other, and when an URL changes another password for the same service gets added, it basically ends up being a giant mess. Unless I missed something is there a local decent password manager that can override the browser password managers for Chrome, Edge, Firefox (profiles) so that there is only one vault, and does that also support Passkeys (which to me are still confusing because sometimes it will ask for a Passkey on a phone I am no longer using!) Microsofts implementation of Passkeys is the worst!
    • It's utterly baffling that we have no idea when we'll get new features even well after they've been released. Why Microsoft thinks this is a good rollout strategy is beyond me.
    • If it makes anybody happy, others will need to be bitter about it. (apologies to Yogi Berra)
  • Recent Achievements

    • First Post
      DrWankel earned a badge
      First Post
    • Reacting Well
      DrWankel earned a badge
      Reacting Well
    • 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
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      +Edouard
      163
    3. 3
      PsYcHoKiLLa
      91
    4. 4
      Steven P.
      75
    5. 5
      Michael Scrip
      72
  • Tell a friend

    Love Neowin? Tell a friend!