无法在Mozilla Firefox和Internet Explorer中查看水平菜单

时间:2014-03-10 08:59:23

标签: html css cross-browser

在下面的代码中,我无法在Mozilla Firefox和Internet Explorer中查看水平菜单。

这是我的菜单HTML

<div class="menu">
    <ul id="menu">
        <li><a href="../index.php">Home</a></li>
        <li><a href="../faqs.php">Faqs</a></li>
        <li><a href="../contact.php">Contact Us</a></li>
    </ul>
</div>

这是我的菜单CSS

@font-face {
    font-family: 'Segoe print’;
    src:url('fonts/Segoe.eot?#’) format(‘eot’),    
        url(‘fonts/Segoe.woff’) format(‘woff’), 
        url(‘fonts/Segoe.ttf’) format(‘truetype’);  
}

#menu, #menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
    font-weight: bold

}

#menu {
    width: 400px;
    /*border: 1px solid #222;
    background-color: #111;
    background-image: linear-gradient(#444, #111);*/
    border-radius: 6px;
    background: rgb(107,91,90); /* Old browsers */
    background: #993333; /* Old browsers */
    background: #cc6666; /* Old browsers */
    background: #cc3333; /* Old browsers */
    background: #cc6666; /* Old browsers */
    background: #cc3333; /* Old browsers */
    /* IE9 SVG, needs conditional override of 'filter' to 'none' */
    background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2NjMzMzMyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjQzJSIgc3RvcC1jb2xvcj0iI2NjMzMzMyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjYwJSIgc3RvcC1jb2xvcj0iIzk5MzMzMyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM5OTMzMzMiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
    background: -moz-linear-gradient(top,  #cc3333 0%, #cc3333 43%, #993333 60%, #993333 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cc3333), color-stop(43%,#cc3333), color-stop(60%,#993333), color-stop(100%,#993333)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  #cc3333 0%,#cc3333 43%,#993333 60%,#993333 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #cc3333 0%,#cc3333 43%,#993333 60%,#993333 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #cc3333 0%,#cc3333 43%,#993333 60%,#993333 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #cc3333 0%,#cc3333 43%,#993333 60%,#993333 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc3333', endColorstr='#993333',GradientType=0 ); /* IE6-8 */

    box-shadow: 0 1px 1px #777;
    margin-top: 25px;
    margin-right: auto;
    margin-bottom: 10px;
    margin-left: auto;
    -moz-box-shadow: 0 0 5px 2px #888;
    -webkit-box-shadow: 0 0 5px 2px #888;
    box-shadow: 0 0 5px 2px #888;
    border-radius:10px;
}

#menu:before,
#menu:after {
    content: "";
    display: table;
}

#menu:after {
    clear: both;
}

#menu {
    zoom:1;
}

#menu li {
    float: left;

    position: relative;
}

#menu a {
    float: left;
    color: #FFF;
    text-decoration: none;
    text-shadow: 0 1px 0 #000;
    font-family:Segoe print;

    font-size: 16px;
    font-weight: bold;
    padding-top: 5px;
    padding-right: 30px;
    padding-bottom: 5px;
    padding-left: 30px;
}

#menu li:hover > a {
    color: #fafafa;
}

*html #menu li a:hover { /* IE6 only */
    color: #fafafa;
}

#menu ul {
    margin: 20px 0 0 0;
    _margin: 0; /*IE6 only*/
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 38px;
    left: 0;
    z-index: 51;
    background: #444;
    background: linear-gradient(#444, #111);
    box-shadow: 0 -1px 0 rgba(255,255,255,.3);
    border-radius: 3px;
    transition: all .2s ease-in-out;
}

#menu li:hover > ul {
    opacity: 1;
    visibility: visible;
    margin: 0;
}

#menu ul ul {
    top: 0;
    left: 150px;
    margin: 0 0 0 20px;
    _margin: 0; /*IE6 only*/
    box-shadow: -1px 0 0 rgba(255,255,255,.3);      
}

#menu ul li {
    float: none;
    display: block;
    border: 0;
    _line-height: 0; /*IE6 only*/
    box-shadow: 0 1px 0 #111, 0 2px 0 #666;
}

#menu ul li:last-child {   
    box-shadow: none;    
}

#menu ul a {    
    padding: 10px;
    width: 150px;
    _height: 7px; /*IE6 only*/
    display: block;
    white-space: nowrap;
    float: none;
    text-transform: none;
}


#menu ul a:hover {
    background-color: #f80033;
    background-image: linear-gradient(#f80033, #955d61);

}

#menu li:hover {
    border-radius:10px 10px 10px 10px;
    background-color: #f80033;
    background-image: linear-gradient(#F99, #955d61);
}

#menu ul li:first-child > a {
    border-radius: 3px 3px 0 0;
}

在上面的代码中,我无法在Mozilla Firefox和Internet Explorer中查看水平菜单。

1 个答案:

答案 0 :(得分:-1)

由于您在属性中的引号,因此不支持您的font-face属性。您使用不同类型的引号可能是因为复制粘贴...由于此问题,您的CSS的其余部分将无法在FF中正确解释。 对于IE,请使用*.eot字体而不使用format attribut。

请参阅下面正确的@ font-face规则:

@font-face {
    font-family: 'Segoe print';
    src:url('fonts/Segoe.eot') ,    
        url('fonts/Segoe.woff') format('woff'), 
        url('fonts/Segoe.ttf') format('truetype');  
}