开发者

filter:alpha breaks :hover in IE?

When using

filter:alpha(opacity=60);

on a div containing an unordered list which has :hover on the list items, IE8 will only activate the :hover event on the first item that is hovered over.

Moving up/down t开发者_Go百科o another list item will no longer activate the :hover event. This works in firefox however.

There is an example at http://www.ithinkimlost.com/paul/ese/test.html

Any ideas what would be causing this?


Try this syntax:

-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=60)";
filter: alpha(opacity=60);
opacity: 0.60;

Some ideas that might fix it:

  • reset the opacity on the :hover
  • set an height on the lis
  • add a position and remove the clear
  • move #homeOptions above the :hover in the code


try this sheet:

#homeContent {
    margin-left: 15px;
}

#homeMainPic {
    background:url(main_pic.jpg) no-repeat;
    height: 216px;
}

#homeOptions {
    height: 216px;
    width: 300px;
}

#homeOptions ul {
    height: 216px;
    overflow: hidden;
    padding: 0;
    margin: 0;
}


#homeOptions li {
    display: block;
    padding: 0 0 0 30px;
    margin: 0;
    vertical-align: middle;
    text-align: left;
    zoom:1;

    background-color:#009;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=60)";
    filter:alpha(opacity=60);
    opacity: 0.60;

}

/* it is needed - don't ask why */
#homeOptions li:hover {
    background-color:#009;
}

#homeOptions a {
    display: block;
    width: 100%;
    vertical-align: middle;
    line-height: 72px;
    height: 72px;
    color: #fff;
    text-decoration: none;
    font-size: 1.1em;

    border-bottom: 1px dashed white;

    display: list-item;
    list-style-type: disc;
    list-style-position: inside;

    padding-left: 30px;
}

#homeOptions a:hover {
    background-color: #000;
}


Change this:

#homeOptions ul li img {
    vertical-align:middle;
    margin-right: 20px;
    filter:alpha(opacity=60);
    opacity: 0.60;
}

#homeOptions {
    background-color:#009;
    height: 216px;
    width: 300px;
    float: left;    
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜