CSS :hover and Internet Explorer 6?

E

Erik Harris

Does Internet Explorer 6 support the CSS ":hover" attribute, or am I simply
doing something wrong? All of the links on my websites (linked to in my
signature) change color when the mouse hovers over them in Mozilla, but
nothing happens in Internet Explorer 6.

--
Erik Harris n$wsr$ader@$harrishom$.com
AIM: KngFuJoe http://www.eharrishome.com
Chinese-Indonesian MA Club http://www.eharrishome.com/cimac/

The above email address is obfuscated to try to prevent SPAM.
Replace each dollar sign with an "e" for the correct address.
 
D

David Dorward

Erik said:
Does Internet Explorer 6 support the CSS ":hover" attribute

Only on said:
or am I simply doing something wrong?

MSIE doesn't support attribute selectors, so it doesn't recognise
a[href]:hover.

Use a:link:hover and a:visited:hover instead.
 
J

Jukka K. Korpela

rf said:
IE doesn't support a[href]:hover. Use a:hover or .content a:hover or
whatever.

David's suggestion to use a:link:hover and a:visited:hover is better,
since Mozilla treats :hover as applying to almost any element, so if
there's e.g. <a name="...">...</a> somewhere, it would match a:hover.
 
R

rf

Jukka K. Korpela said:
rf said:
IE doesn't support a[href]:hover. Use a:hover or .content a:hover or
whatever.

David's suggestion to use a:link:hover and a:visited:hover is better,
since Mozilla treats :hover as applying to almost any element, so if
there's e.g. <a name="...">...</a> somewhere, it would match a:hover.

Good point.

Cheers
Richard.
 
E

Erik Harris

Only on <a> elements

That's kind of a pain, especially if you want it to behave differently on
text links and image links. For example, I've got:

a[href]:hover { color: #EEA; background: transparent; text-decoration:
underline }
a:hover IMG {border: 1px solid #EEA}

Neither works. So apparently, IE not only doesn't support attribute
selectors, but it also doesn't support context-dependent styles (a:hover
IMG). I don't want the text links to have a 1 pixel solid border, so
combining them into one doesn't appear to be an option.
MSIE doesn't support attribute selectors, so it doesn't recognise
a[href]:hover.
Use a:link:hover and a:visited:hover instead.

The reason I didn't just use "a:hover" (or the above choices) is because I
didn't want my <a name=""> place-mark links to be hilighted. And I believe
the Validator balked at <a name="text"></a> (which is fine when its only
purpose is to mark the beginning of a section) because it didn't like an
empty <a></a>.

--
Erik Harris n$wsr$ader@$harrishom$.com
AIM: KngFuJoe http://www.eharrishome.com
Chinese-Indonesian MA Club http://www.eharrishome.com/cimac/

The above email address is obfuscated to try to prevent SPAM.
Replace each dollar sign with an "e" for the correct address.
 
J

Jukka K. Korpela

Erik Harris said:
It still doesn't help the case of the contextual selector I'd like
to use, though (a:hover IMG), since IE only allows :hover with <a>,
and since I want borders around hovered link images, but not text
links.

You can use e.g.

:link img { border: solid blue thin; }
:visited img { border: solid #939 thin; }
:link:hover img, :visited:hover img { border-color: red; }
 
E

Erik Harris

You can use e.g.

:link img { border: solid blue thin; }
:visited img { border: solid #939 thin; }
:link:hover img, :visited:hover img { border-color: red; }

Thanks, I'll give that a go.

--
Erik Harris n$wsr$ader@$harrishom$.com
AIM: KngFuJoe http://www.eharrishome.com
Chinese-Indonesian MA Club http://www.eharrishome.com/cimac/

The above email address is obfuscated to try to prevent SPAM.
Replace each dollar sign with an "e" for the correct address.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top