【问题标题】:How do I fix ie 6 hover?如何修复即 6 悬停?
【发布时间】:2011-02-05 17:59:25
【问题描述】:

这是我的菜单代码:

/*Menu*/    
#menu {
    text-align: right;
    margin-left: auto;
    margin-right: auto;
    height: 50px;
    position: relative;
    z-index: 5;
    font-size: 0.75em;
}

#menu ul {
    margin: 0;
    padding: 10px 5px 5px 5px;
    list-style: none;
    line-height: normal;
    border: 0px solid #03426A;
    -moz-border-radius: 6px;
    background: #F3F4FF;
    position:relative;
    width: auto;
    float:right;
}
#menu ul li {
  float: left;
}
#menu li ul {
    display: none;
}
#menu ul li a {
    display: block;
    text-decoration: none;
    color: #000;  
    display: block;
    padding: 0px 15px 5px 15px;
    text-decoration: none;
    text-align: center;
    font-size: 1em;
    font-weight: normal;
    border: none;
}
#menu ul li a:hover {
    color: #0A67A3; 
}
#menu li:hover ul {
  display: block;
  position: absolute;
}
#menu li:hover li {
  float: none;
  font-size: 0.9em;
}
#menu li:hover a { color: #0A67A3; }
#menu li:hover li a:hover { color: #000; }

/*End Menu*/

我已经尝试了 2 个教程,但是没有找到使菜单在 ie 5.5 或 6 中工作的方法。我该如何解决这个问题?

【问题讨论】:

  • 复制你的 html 也...没关系,答案是下来..

标签: html menu drop-down-menu hover


【解决方案1】:

IE6 不支持 :hover 伪类在锚标记以外的元素上。 Suckerfish 的儿子有一个可能适合您的解决方案:http://www.htmldog.com/articles/suckerfish/dropdowns/

【讨论】:

  • 嗯.. 我仍然无法让它工作。我在哪里放置 javascript 代码?
【解决方案2】:

IE 5.5?真的...哇,如果您仍然需要兼容那么远,我为您感到难过...我想是遗留企业应用程序?该死!!

IE6 只能理解 :hover<a> 元素,这是肯定的。但是您可以尝试这里给出的解决方案,它使用 htc 文件来创建新的 css 行为:http://www.xs4all.nl/~peterned/csshover.html

【讨论】:

  • 哇,这个技巧实际上在 ie 5.5 中有效!谢谢,它在旧浏览器上看起来不太好,但至少它们现在可以正常导航了!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-01-09
  • 1970-01-01
  • 1970-01-01
  • 2018-07-27
  • 1970-01-01
  • 1970-01-01
  • 2015-05-23
相关资源
最近更新 更多