/    Sign up×
Community /Pin to ProfileBookmark

:hover – works in Firefox and not IE7?

Hi there,

I’ve got an CSS issue that I can’t get it right….

Here’s the CSS code:

[CODE]
.navmenus td { color: #FFFFFF;
background-color: transparent;
background-image: url(images/nohighlight.png);
text-decoration: none;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 12px;
font-weight: 700;
cursor: pointer;
padding-left: 5px}
.navmenus td:hover { background-image: url(images/menuhighlight.png)}

#trial{ background-color: transparent;
layer-background-color: #FFFFFF;
border-left: 6px solid #FFFFFF;
width: 225px;
top: 0px;
left: 304px;
position: absolute;
z-index: 90;
visibility: hidden;
text-align: left}
[/CODE]

and here’s the HTML which the above code is applied to:

[CODE]
<span class=”navmenus”>
<div id=”trial”>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”100%”>
<tr><td height=”30″ onClick=”window.location.href=’test.htm'” onMouseOver=”stopTime()” onMouseOut=”startTime()”>Hello!!!</td></tr>
<tr><td height=”30″ onMouseOver=”stopTime()” onMouseOut=”startTime()”>Hello!!!</td></tr>
<tr><td height=”30″ onMouseOver=”stopTime()” onMouseOut=”startTime()”>Hello!!!</td></tr>
</table>
</div>
</span>
[/CODE]

now just a bit of introduction on what exactly it’s happening up there… I have a drop-down menu done by JavaScript, so when you move your mouse over a button, this menu drops down magically… ok, it’s just the layer’s visibilty changes from hidden to visible and vice versa.

Now the problem does not concern my JavaScript, but it’s the CSS styles I’m talking about… each item on the layer above is supposed to be “highlighted” with a background-image, but “non-highlighted” with another background-image when no mouse is over it. In both Firefox and IE7, there is a background for “non-highlighted”, but no highlighting occurs for IE7 when a mouse moves over a table cell.

As a sidenote, this page is a frame inside a frameset; when I built another version of my site that doesn’t use frames, the highlighting works in both browsers…. @_@

Any help gladly appreciated….. Thanks a lot!!!

Chimaera

to post a comment
CSS

8 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelSep 10.2007 — The pseudo-class ":hover" is only supported by IE when it is attached to an anchor such as

.navmenus td [B]a[/B]:hover {[I]foo:bar[/I];....}

whereas it would ignore:

.navmenus td:hover {[I]foo:bar[/I];....}

I'm alittle surprised (well, -not too surprised) that IE7 doesn't obey pseudo-class for non-anchor.

If you are changing the background-color or background-image for a TD that has no anchor in it, you want to use *htc

http://www.vladdy.net/demos/iepseudoclassesfix.html
Copy linkTweet thisAlerts:
@KravvitzSep 11.2007 — When in standards mode IE7 does support :hover on more elements than just <a>.

Which doctype are you using, chimaera_ex? Did you put [i]anything[/i] before it?
Copy linkTweet thisAlerts:
@chimaera_exauthorSep 11.2007 — well, as I've said previously, I'm using frames, so the DOCTYPE for the frameset (i.e. index.htm) is naturally

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

I didn't declare any DOCTYPE for the frames inside (neither Transitional nor Strict), but do I have to do that?

and btw, I've got no idea what .htc is.... can someone elaborate more on this and how to use it? (I was thinking of spamming onMouseOver and onMouseOut events too)
Copy linkTweet thisAlerts:
@KravvitzSep 11.2007 — 1) Ew! frames.

2) Yes! Pages loaded in frames are separate; they don't inherit anything from the page that contains the frames.

3) Didn't you follow Joel's link? Here's another: [url=http://www.xs4all.nl/~peterned/csshover.html]whatever:hover[/url]
Copy linkTweet thisAlerts:
@WebJoelSep 11.2007 — FRAMES! (standing behind chair viewing screen though my fingers...). 'xplains alot. ?
Copy linkTweet thisAlerts:
@chimaera_exauthorSep 11.2007 — hang on.... I didn't apply my CSS styles inside the frameset page (index.htm), but in the inside frames... so that doesn't explain anything ?

I mean, I only have to declare DOCTYPE in the frameset page once and not in the subsidiary frames, right?

anyway, I'll try Joel's link and see if I understand it or not...
Copy linkTweet thisAlerts:
@ray326Sep 11.2007 — You declare the frameset doctype on the frameset page and strict/transitional on the others.
Copy linkTweet thisAlerts:
@chimaera_exauthorSep 12.2007 — ah... I've indeed solved the problem with the .htc file... thanks for all your help, and also on the information about DOCTYPE. Just simply.... thanks a lot!!!!! ?
×

Success!

Help @chimaera_ex 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,
)...