472,958 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Image Links and Hover not working on IE


I want to have a border around an image that changes color when the
mouse hovers over it. The following code works perfectly in FireFox
but not in Internet Exploiter. The text link changes color but the
image link stays the same. Anybody know how I can make it work in IE?
I saw a web site where the guy got it to work in both browsers.
<html>
<head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<style>
a:link {
color: #00FF00;
text-decoration: underline;
}
a:visited {
color: #ffff00;
text-decoration: underline;
}
a:hover {
color: #ff0000;
border: thin none #FFFFFF;
text-decoration: underline;
}
a:active {
color: #00ffff;
text-decoration: underline;
}
</style>
</head>

<body>

<a href="http://www.spreadshirt1.com">Hello World</a>
<br>
<br>
<br>
<a href="http://www.spreadshirt2.com"><img
src="tshirt_images/bomb_cod_160.jpg" border=2></a>

</body>
</html>

Apr 1 '07 #1
7 17221
Els
Cate Archer wrote:
I want to have a border around an image that changes color when the
mouse hovers over it. The following code works perfectly in FireFox
but not in Internet Exploiter. The text link changes color but the
image link stays the same. Anybody know how I can make it work in IE?
I saw a web site where the guy got it to work in both browsers.
[snip code]

http://locusoptimus.com/css-trickery...s-on-hover.php
--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Apr 1 '07 #2
Scripsit Els:
>I want to have a border around an image that changes color when the
mouse hovers over it. The following code works perfectly in FireFox
but not in Internet Exploiter. The text link changes color but the
image link stays the same. Anybody know how I can make it work in IE?
- -
http://locusoptimus.com/css-trickery...s-on-hover.php
That document discusses a phenomenon that cannot be observed on my copy of
IE 6. The demo image behaves differently from what the page says. I suppose
some old, unpatched versions of IE 6 needed the "trigger" described on the
page.

IE 6 supports :hover for links only, not for <aelements for example. To
set border color for image links, you need to set border or border-color for
:hover img. In this case, :hover is being used for links only, so the IE 6
limitations on :hover are not the issue.

Rather, the issue is that the code posted sets link colors, not border
colors for images used as links. (The code also sets border: thin none
#FFFFFF rather pointlessly - how much do border color and thickness matter
when there is no border?)

When you have <a href="..."><img ...></a>, then the img element inherits its
parent's color when _no_ style sheet sets the img element's color. Moreover,
the initial value for border-color is the element's color value.

Thus, apparently Firefox has a default browser style sheet different from
that of IE, as regards to setting border colors of image links in different
states. This shouldn't really surprise us, should it?

When setting properties, it is best to set the property you want to set,
instead of relying on inheritance and initial values, which are like a
smiling cat (look very nice on the surface but surprise people who rely on
them). Thus, instead of setting color for a:hover, set

a:hover img { border-color: #f00; }

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Apr 2 '07 #3
Els
Jukka K. Korpela wrote:
Scripsit Els:
>>I want to have a border around an image that changes color when the
mouse hovers over it. The following code works perfectly in FireFox
but not in Internet Exploiter. The text link changes color but the
image link stays the same. Anybody know how I can make it work in IE?
- -
>http://locusoptimus.com/css-trickery...s-on-hover.php

That document discusses a phenomenon that cannot be observed on my copy of
IE 6. The demo image behaves differently from what the page says. I suppose
some old, unpatched versions of IE 6 needed the "trigger" described on the
page.
That's a problem with IE/Microsoft: they keep changing the behaviour
without telling anyone ;-)
FWIW, my IE6 is now a standalone version, and still exhibits the
behaviour described. I wrote that page when IE7 was still in Beta, and
then my IE6 was native and updated and it did show the described
behaviour. I'd be interested to know which current versions of IE6 do
and which don't still need that trigger. What version and of IE6 on
which OS are you using?
IE 6 supports :hover for links only, not for <aelements for example. To
set border color for image links, you need to set border or border-color for
:hover img. In this case, :hover is being used for links only, so the IE 6
limitations on :hover are not the issue.
True, but the page still explains also how to do what the OP wants. I
could have mentioned that though, you're right.

[snip good explanation on how to change border(-colour)s on image
links]

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Apr 2 '07 #4
Scripsit Els:
I'd be interested to know which current versions of IE6 do
and which don't still need that trigger. What version and of IE6 on
which OS are you using?
I used IE 6.0.2800.1106 on Windows 98.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Apr 2 '07 #5
Els
Jukka K. Korpela wrote:
Scripsit Els:
>I'd be interested to know which current versions of IE6 do
and which don't still need that trigger. What version and of IE6 on
which OS are you using?

I used IE 6.0.2800.1106 on Windows 98.
Hmm.. yesterday I fired up my kids old Win 98 laptop, navigated to
Internet Explorer (I let them use Firefox always), and checked the
version: 6.0.2800.1106 (SP1). The behaviour of the image link was
exactly as on my example.
I then went to Microsoft Update center, downloaded all the latest
security patches, restarted the machine, and checked again - the image
link still did what I wrote it did.
Is there anything else in which your version could be different from
mine?

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Apr 3 '07 #6
Els wrote:
Jukka K. Korpela wrote:
>Scripsit Els:
>>I'd be interested to know which current versions of IE6 do
and which don't still need that trigger. What version and of IE6 on
which OS are you using?
I used IE 6.0.2800.1106 on Windows 98.

Hmm.. yesterday I fired up my kids old Win 98 laptop, navigated to
Internet Explorer (I let them use Firefox always), and checked the
version: 6.0.2800.1106 (SP1). The behaviour of the image link was
exactly as on my example.
Is there anything else in which your version could be different from
mine?
I am seeing the same behaviour with the image links on that page as
Jukka Korpela. For IE I have IE 6.0.2900.2180 and XP Pro both with all
patches.

However the IE problem created by IE treating action pseudo class as
focus also is evident if the calling page is "re-got" from cache, such
as when the user does this with his browser's back button. I understand
that this has been fixed with IE7. Is this right?

Louise
Apr 3 '07 #7
Els
boclair wrote:
Els wrote:
>Jukka K. Korpela wrote:
>>Scripsit Els:

I'd be interested to know which current versions of IE6 do
and which don't still need that trigger. What version and of IE6 on
which OS are you using?
I used IE 6.0.2800.1106 on Windows 98.

Hmm.. yesterday I fired up my kids old Win 98 laptop, navigated to
Internet Explorer (I let them use Firefox always), and checked the
version: 6.0.2800.1106 (SP1). The behaviour of the image link was
exactly as on my example.
Is there anything else in which your version could be different from
mine?

I am seeing the same behaviour with the image links on that page as
Jukka Korpela. For IE I have IE 6.0.2900.2180 and XP Pro both with all
patches.
Does that mean you didn't upgrade to IE7 then? May I ask why?
I did (XP Home), and I'm not about to go back to IE6 to check whether
I can replicate what you and Yukka are seeing ;-)
However the IE problem created by IE treating action pseudo class as
focus also is evident if the calling page is "re-got" from cache, such
as when the user does this with his browser's back button.
Not sure if I understand what you mean. IE always neews the :active
style where other browsers use :focus. To test this, use your tab key
to jump from link to link (which should give each on focus as you hit
it), without having a style for :active in your stylesheet.
What you see when using the back button, is the actual :active style,
just as in other browsers as far as I know. It's just :focus that
doesn't work in IE.
I understand that this has been fixed with IE7. Is this right?
Just tested: IE7 still needs the :active rules to act instead of
:focus. Without :active styles, nothing happens when a link receives
focus.
--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Apr 4 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Chris Beall | last post by:
I'm displaying an image that is also a link against a black background. In Netscape 7.1, the current background color is displayed as a horizontal bar below the image. This allows :hover effects...
33
by: Thomas Mlynarczyk | last post by:
Hi, I'm looking for a way to put a 1px solid border around the image in this link: <a href="some.html"><img src="some.gif"></a> Well, that, by itself, is simple. However, I would like to have a...
6
by: killerkatt | last post by:
I am new to CSS and would like to know if there is a way to make this happen with CSS: image1 and image 2 are laid out at the top of the page. when the mouse hovers over image1, a paragragh or...
3
by: Mark Tranchant | last post by:
On my site, I use a background image of a small arrow to denote links that lead away from my site. This page has four such links in the first section: http://tranchant.plus.com/notes/cable-wrap...
15
by: Applebrown | last post by:
I've got a couple of errors on my site that I'm not sure how to fix. I'm using simple CSS for both text rollovers and my horizontal navbar, and here's what happens. First, the site: ...
21
by: adrian suri | last post by:
Hi just started to experement with styleshhets, and have defined hover a:hover { Color : red; Text-decoration : none; Border-top-width : medium; Border-right-width : medium;
7
by: KiwiBrian | last post by:
On a web page I have a graphic for a Shopping Cart Submit button. It is within a form and working fine. I would like to perform an image swap to an identical graphic of a different colour when I...
7
by: fredo | last post by:
I've studied Eric Meyer's pure css popups, version two: http://meyerweb.com/eric/css/edge/popups/demo2.html which pops up an image when I roll over a text link. Now I want to pop up a large...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.