/    Sign up×
Community /Pin to ProfileBookmark

img hover state in IE

Hi!

How can I get the CSS style for img:hover to work in IE? I’ve added the attribute of a border when the user hovers over the image, but it doesn’t work in IE..

#portfolio_screenshot_thumbs {
margin:5px 10px 5px 10px;
border:1px solid #f9fbfc;
}

#portfolio_screenshot_thumbs img {
margin:5px 10px 5px 10px;
border:1px solid #f9fbfc;
}

#portfolio_screenshot_thumbs img:hover {
margin:5px 10px 5px 10px;
border:1px solid #26adff;
}

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@pauledeeNov 08.2010 — Hi

I think you mean it doesn't work in IE6? - seems to display fine for me in IE7 and IE8.

I have no idea WHY... but IE6 has problems rendering styles applied when a selector is used with a tag... eg:
[CODE]img:hover[/CODE]

However, IE6 does render this ok:
[CODE]<style type="text/css">

#portfolio_screenshot_thumbs {
margin:5px 10px 5px 10px;
border:1px solid #f9fbfc;
}

#portfolio_screenshot_thumbs [COLOR="Red"]a.imgRollover[/COLOR] {
margin:5px 10px 5px 10px;
border:1px solid #f9fbfc;
}

#portfolio_screenshot_thumbs [COLOR="Red"]a.imgRollover:hover[/COLOR] {
margin:5px 10px 5px 10px;
border:1px solid #26adff;
}

</style>[/CODE]



  • - as long as you rework the structure a little:
    [code=html]<div id="portfolio_screenshot_thumbs">
    <a href="http://aurl" target="_blank" class="imgRollover">
    <img src="animage.jpg" border="0" />
    </a>
    </div>[/code]


  • Beware though: the above option is IE6 only - you'll need to apply it as a conditional CSS because it breaks in the other browsers.
    Copy linkTweet thisAlerts:
    @NulrickauthorNov 08.2010 — Hi!

    Hm, well I should mention that I'm on a mac and checking my working using parallels (virtual PC) which has IE 8 installed, not IE 6, and I'm still experiencing the problem.

    I went ahead and implemented your code and all that happens is it adds the default blue border around the images, not the CSS border, nor does anything change in the hover state..

    but you said that it appears to work correctly for you in IE 7 and 8? Please see the link below and rollover the large thumbnails to the right of the iPhone:

    http://www.nicnackproductions.com/nicnacks/mobiddy/portfolio.html


    Thanks!
    Copy linkTweet thisAlerts:
    @pauledeeNov 09.2010 — I went ahead and implemented your code and all that happens is it adds the default blue border around the images, not the CSS border, nor does anything change in the hover state..

    but you said that it appears to work correctly for you in IE 7 and 8? Please see the link below...[/QUOTE]


    Your link doesn't work for some reason ?

    However, I am testing on a real PC and your original code works on IE7 and IE8 ?

    Incidentally, you should definitely not be seeing a default blue border on the image link - the border is removed with the code attribute 'border="0"'. Either way, the code I posted was explicitly for IE6 anyways.
    ×

    Success!

    Help @Nulrick spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.15,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...