如何设置IE的不透明度?鼠标悬停的问题

发布于 2024-09-12 00:50:37 字数 789 浏览 6 评论 0原文

当我尝试在 css 中设置不透明度时,鼠标悬停事件不会被触发。我的CSS代码是-

.dropmenudiv_a{
    position:absolute;
    top: 0;
    border: 1px solid white; /*THEME CHANGE HERE*/
    border-top-width: 8px; /*Top border width. Should match height of .ddcolortabsline      above*/
    border-bottom-width: 0;
    border-left-width: 0;
    border-right-width: 0;
    font:normal 12px Arial;
    line-height:18px;
    z-index:100;
    background-color: lightgray;
    width: 200px;
    visibility: hidden;
    opacity:0.9;
    filter: alpha(opacity = 50); // for IE
}   

.dropmenudiv_a a:hover{ /*THEME CHANGE HERE*/
    background:url(media/menuover.jpg) repeat-x top;
    color: white;
}

鼠标悬停时的背景图像在MOZILA中发生变化,但在IE中没有变化?当我删除过滤器:alpha(opacity = 50);时,它在IE中也工作正常,但不透明度在IE中不会出现。 ....????

When I am trying to set opacity in css, mouse over event is not getting fired. my css code is-

.dropmenudiv_a{
    position:absolute;
    top: 0;
    border: 1px solid white; /*THEME CHANGE HERE*/
    border-top-width: 8px; /*Top border width. Should match height of .ddcolortabsline      above*/
    border-bottom-width: 0;
    border-left-width: 0;
    border-right-width: 0;
    font:normal 12px Arial;
    line-height:18px;
    z-index:100;
    background-color: lightgray;
    width: 200px;
    visibility: hidden;
    opacity:0.9;
    filter: alpha(opacity = 50); // for IE
}   

.dropmenudiv_a a:hover{ /*THEME CHANGE HERE*/
    background:url(media/menuover.jpg) repeat-x top;
    color: white;
}

background image on mouse over is getting changed in MOZILA but not in IE?When I remove filter: alpha(opacity = 50);, it is workin fine in IE also but then opacity is not coming in IE......????

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不知在何时 2024-09-19 00:50:37

对于 IE,您必须删除/重置过滤器样式,如下所示:

.dropmenudiv_a a:hover{ /*THEME CHANGE HERE*/
  filter: none; /* resets the filter */
  background:url(media/menuover.jpg) repeat-x top;
  color: white;
}

在 IE8 (Windows 7) 中尝试成功。

For IE you have to remove/reset the filter style, like this:

.dropmenudiv_a a:hover{ /*THEME CHANGE HERE*/
  filter: none; /* resets the filter */
  background:url(media/menuover.jpg) repeat-x top;
  color: white;
}

Tried it in IE8 (Windows 7) with success.

网白 2024-09-19 00:50:37

您可能看到的是 IE 错误,其中应用了 filter 的容器内的链接变得无法点击且无法聚焦。

有时有效的修复方法是向链接添加 z-index:

.dropmenudiv_a a { 
    position: relative;
    z-index: 1;
}

What you're probably seeing is the IE bug where links within a container that has a filter applied become unclickable and unfocusable.

A fix that sometimes works is to add a z-index to your links:

.dropmenudiv_a a { 
    position: relative;
    z-index: 1;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文