/    Sign up×
Community /Pin to ProfileBookmark

what to do with IE6 not supporting something:hover

Hi folks –

I’ve inherited a CSS-based single-level drop down menu. It works in FF, NS and IE7 but not in IE6. That is, the drop-down stuff doesn’t appear when you hover over the main category.

I’ve tracked the problem down to IE6 not supporting :hover unless it’s a:hover. It looks like the original designer may have tried a javascript patch, since I see a repeat declaration of the affected CSS rule.

Problem: I’ve also tracked down that a referenced javascript.js file is missing.

Question: What would be in that javascript file? I’ve tried the suckerfish thing, and it doesn’t work plus breaks FF, NS and IE7. It could be I don’t understand where to put what and just need more exact directions.

Here is a snippet of the calling HTML/CSS (the main menu):
<div id=”navMain”>
<ul>
<li><a href=”about/index.html”>About Us</a>
<ul>
<li><a href=”about/mission-goals.html”>Mission and Goals</a></li>
<li><a href=”about/history.html”>History</a></li>
</ul>
</li>
</ul>
</div>

… and here are the associated CSS rules (the very last one is the problem, see the duplicate declaration of “div#navMain li.over ul”, in which I suspect the “li.over” is actually a javascript thing):

/*************************************** NAVMAIN -> LISTS ***************************************/
#navMain {
width: 100%;
float: left;
background: url(../images/navbarBackground.gif) 0 0 repeat-x;
}
div#navMain ul {
margin: 0;
padding: 0;
list-style: none;
font: normal 10px verdana;
font-weight: bold;
}
div#navMain ul li {
position: relative;
float: left;
}
div#navMain ul li a {
float: left;
display: block;
text-decoration: none;
color: #fff; /*
white*/
padding: 5px 15px;
margin: 0;
border-right: 1px solid #590B0C;
height: 25px; /*
**
Box Model Hack. This line sets the value for Win IE 5. ***/
voice-family: “”}””; /*
**
Box Model Hack. ***/
voice-family: inherit; /*
**
Box Model Hack. ***/
height: 15px; /*
**
Actual value. ***/
}
html>body div#navMain ul li a { /*
**
Box Model Hack: Be Nice to Opera Rule. ***/
height: 15px; /*
**
Actual value. ***/
}
div#navMain ul li a:hover {
color: #fff;
text-decoration: none;
background: #8F3031; /*
lighter color when hovering over menu choice*/
}
div#navMain ul ul {
display: none; /*
**
Hides drop-down menu items ***/
float: left;
clear: left;
list-style: none;
position: absolute;
top: 25px;
margin: 0;
}
div#navMain ul ul li {
float: none;
clear: left;
}
div#navMain ul ul li a {
display: block;
width: 165px;
font-weight: normal;
color: #eee;
padding: 2px 15px;
border: 1px solid #7E1011;
border-top: 1px solid #3F0808;
background: #7E1011;
}
div#navMain ul ul li a:hover {
color: #fff;
background: #8F3031;
text-decoration: none;
border-bottom: 1px solid #3F0808;
border-right: 1px solid #3F0808;
border-top: 1px solid #9D494A;
border-left: 1px solid #9D494A;
}

div#navMain li:hover ul, div#navMain li.over ul
display: block; /*** Shows drop-down menu items on hover ***/
}

Thanks in advance for any help you can offer, and don’t bother asking if I can round up the missing javascript.js file, the original designer went missing 2 years ago and left this project undone. -Owly

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelMar 10.2007 — ... and here are the associated CSS rules (the very last one is the problem, see the duplicate declaration of "div#navMain li.over ul", in which I suspect the "[B]li.over[/B]" is actually a javascript thing):[/QUOTE] No, -this is still CSS, just a "class" for those <li>.

The javascript that makes non-anchor accept the pseudo-class is:

[code=html]<PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="DoHover()" />
<PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="RestoreHover()" />
<PUBLIC:ATTACH EVENT="onmousedown" ONEVENT="DoActive()" />
<PUBLIC:ATTACH EVENT="onmouseup" ONEVENT="RestoreActive()" />
<SCRIPT LANGUAGE="JScript">
function DoHover()
{ element.className += ' hover';
}
function DoActive()
{ element.className += ' active';
}
function RestoreHover()
{ element.className = element.className.replace(/bhoverb/,'');
}
function RestoreActive()
{ element.className = element.className.replace(/bactiveb/,'');
}
</SCRIPT>[/code]
as an external file called "IEFixes.htc", referanced in the HTML with:
[code=html]<style type="text/css">
tr, td {behavior: url('IEFixes.htc');}
table {background:#aaf; border:double #000 5px; border-collapse: collapse;}
td {text-align:center; border:1px solid black;}
tr {background-color:#aaf;}
td:hover, td.hover a, td a.hover, td a:hover {background:#efefef; color:red; display:inline-block; display:block; padding:44px 18px 44px 18px; text-decoration:none; font-weight:bold;}
</style>[/code]

However, I have not had success in getting this work on anything but a TABLE, as it is written here. Here, the "classname" is being taught to IE to be used as it written like "onmouseover/onmouseout", which IE can understand.

There must be some alternative for the drop-down list. If this site is online somewhere, maybe using a different drop-down entirely would work, -instead of trying to fix this broken one?

'Dropdown lists' are not my favorite thing so I either avoid them, -or get pre-made FREE one like they offer at www.dynamicdrive.com, and merely plug-in the URLs and text that I am using, and be done that way.

Like this one: http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm
Copy linkTweet thisAlerts:
@OwlyauthorMar 11.2007 — thanks, WebJoel. I did find amongst the files one with the extension "htc", and inside is a whole lotta javascript gibberish, similar but more obnoxious than your IEFixes.htc. This file is referenced by the site's one CSS style sheet, like this:

body {

behavior: url(csshover.htc);

}.

I've never heard of the "behavior" thing or an "htc" file. Anyway, the file path for this htc file looked wrong to me, so I fixed that ... and lo and behold, the list-based drop down now menu works, in IE6 as well as FF, IE7 and NS.

Yup, I've found some good stuff at Dynamic Drive. In this case, I really needed to get what's already there working, without starting over from scratch. Thanks for your pointers!
Copy linkTweet thisAlerts:
@ray326Mar 11.2007 — I've never heard of the "behavior" thing or an "htc" file.[/QUOTE]It's IE-specific stuff that most people don't know about until they start trying to make IE work right.
×

Success!

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