IE8在子菜单中钻取(制作透明)文本

时间:2013-03-28 11:33:12

标签: css css3 internet-explorer-8

我使用骨架wp框架制作的子模板存在很大问题。 该网站在FF和Chrome上运行良好,但(显然)在IE8中不起作用。

或者更好的工作,但我在IE中看起来像这样的子菜单有问题: IE view

虽然看起来像这样:

FF view

css菜单代码是这样的:

    /* MENU DI NAVIGAZIONE
================================================== */

.band.navigation {
    background-color: #EEEFEF;

    background: -moz-linear-gradient(top,  #eeefef 0%, #dddddd 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeefef), color-stop(100%,#dddddd)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  #eeefef 0%,#dddddd 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #eeefef 0%,#dddddd 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #eeefef 0%,#dddddd 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #eeefef 0%,#dddddd 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeefef', endColorstr='#dddddd',GradientType=0 ); /* IE6-9 */
}

nav.primario ul, nav ul li {
    margin: 0;
}

nav.primario ul li {
    display: inline;
    float: left;
    position: relative;
}

nav.primario ul li a {
    display: inline-block;
    line-height: 49px;
    color: #424242;
    text-decoration: none;
    letter-spacing: 0.08em;
    /*font-weight: bold;*/
    padding: 0 14px;

    text-shadow: 0.05em 0.05em 0.1em rgba(0,0,0, 0.5);
}

nav.primario ul li a:hover{
    background-color: #afd3db;
    cursor: pointer;
    border-radius: 10px;
    color: #fff;

    background: -moz-linear-gradient(top,  #4b9bae 0%, #418697 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4b9bae), color-stop(100%,#418697)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  #4b9bae 0%,#418697 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #4b9bae 0%,#418697 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #4b9bae 0%,#418697 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #4b9bae 0%,#418697 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4b9bae', endColorstr='#418697',GradientType=0 ); /* IE6-9 */


    -webkit-transition: .5s ease-out;
    -moz-transition: .5s ease-out;
    -o-transition: .5s ease-out;
    -ms-transition: .5s ease-out;
    transition: .5s ease-out;
}

/*Menu a tendina per dispositivi mobili nascosto*/
nav.primario select {
    display: none;
    width: 100%;
    height: 28px;
    margin: 21px 0;
}

/*SOTTO MENU*/
nav.primario ul ul{
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    filter: alpha(opacity=0);
    opacity: 0;

    position: absolute;
    z-index: 999; /*Per farlo apparire sopra il menu*/
    background: #DDDDDD;
    width: 200%;
    min-width: 100%;
    /*Nascondere il menu se non avviene il passaggio del mouse*/
    height: 0px; 
    overflow: hidden;

    -webkit-transition: .5s ease-out;
    -moz-transition: .5s ease-out;
    -o-transition: .5s ease-out;
    -ms-transition: .5s ease-out;
    transition: .5s ease-out;

    -webkit-box-shadow: 2px 2px 2px rgba(0,0,0,0.3);
    box-shadow: 2px 2px 2px rgba(0,0,0,0.3);
}

/*Hover state al menu*/
nav.primario ul li:hover ul {
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=1000)";
    filter: alpha(opacity=1000);
    opacity: 10;

    height: auto;
    overflow: auto;
}

nav.primario ul ul li{
    float: none;
    display: list-item;
}

nav.primario ul ul li a{
    display: block;
    line-height: 35px;
    text-decoration: none;
}

/*fissare il colore al menu principale quando l'hover è attivo nel sottomenu*/
nav.primario ul li:hover > a {
    background-color: #afd3db;
    border-radius: 10px;
}

请我尝试一下,但我无法弄清楚如何让这个子菜单在IE上看起来像样...... 非常感谢所有社区的推荐

1 个答案:

答案 0 :(得分:2)

.band.navigation { 
    background: #EEEFEF; 
    background: -moz-linear-gradient(top,  #eeefef 0%, #dddddd 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeefef), color-stop(100%,#dddddd)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  #eeefef 0%,#dddddd 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #eeefef 0%,#dddddd 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #eeefef 0%,#dddddd 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #eeefef 0%,#dddddd 100%); /* W3C */
}

不要使用filter:它会使渲染速度变慢而且不值得。

这应该解决它