在某些移动浏览器中,CSS3菜单显示不正确

时间:2014-04-12 13:45:42

标签: html css css3 cross-browser browser

我的CSS3菜单在许多旧版移动浏览器中出现问题 - 我找不到错误,为什么会这样。

在所有现代浏览器(FF,IE,Chrome,Safari(iOS7)等)中,菜单如下所示: http://www.fotos-hochladen.net/view/screenshot1fmjd9u2ht6.jpg

但是在较旧的浏览器和较旧的iOS或Android版本菜单中看起来像这样: http://www.fotos-hochladen.net/view/screenshot2835q1dwytu.jpg

我一直在寻找解决方案,但我找不到错误。我使用CMSMS作为内容管理系统,使用以下代码在页面加载时创建菜单:

{if $count > 0}
{$cnt=0}
    <ul id="themenu">
    {foreach from=$nodelist item=node}
        {if $node->depth > $node->prevdepth}
            {repeat string='<ul class="shadow">' times=$node->depth-$node->prevdepth}  
        {elseif $node->depth < $node->prevdepth}
            {repeat string='</li></ul>' times=$node->prevdepth-$node->depth}
            </li>
        {elseif $node->index > 0}</li>
        {/if}

        {if $node->parent == true or ($node->current == true and $node->haschildren == true)}
            <li><a href="{$node->url}">{$node->menutext}</a>
        {elseif $node->current == true}
            <li><a href="{$node->url}">{$node->menutext}</a>
        {elseif $node->haschildren == true and $node->depth==1}
            <li><div id=menuimg style="background:url({uploads_url}/ffg_neu/menuimg/{$cnt++}.png);background-repeat:no-repeat;background-position:50%;background-size:contain;"></div><a href="{$node->url}">{$node->menutext}</a>
        {elseif $node->haschildren == true}
            <li><a style="text-align:left;" href="{$node->url}"><div id=menuimage1></div>{$node->menutext}</a>
        {else}
            <li><a style="text-align:left;" href="{$node->url}"><div id=menuimage></div>{$node->menutext}</a>
        {/if}
    {/foreach}
    </ul>
{/if}

这是菜单的完整CSS:

#themenu, #themenu ul {
    margin: 0;
    padding: 0;
    list-style: none;
    height: 20px;
}
#themenu {
    position:absolute;
    width: 600px;
    margin: 188px 216px auto;
    z-index: 1100; 
}
#themenu:before,
#themenu:after {
    content: "";
    display: table;
}

#themenu:after {
    clear: both;
}

#themenu {
    zoom:1;
}
#themenu li {
    float: left;
    border-bottom: 1px solid #fff;
    position: relative;

    -moz-border-radius: 5px; /* Gecko-Browser (Firefox) */
    -webkit-border-radius: 5px; /* Webkit-Browser (Chrome, Safari) */
    border-radius: 5px; /* CSS3 allgemein */
}
#themenu li:last-child { 
        border-right: 0px solid #fff; 
}

#themenu a {
    float: left;
    padding: 0px 10px;
    color: #fff;
    text-transform: uppercase;
    font: bold 12px Arial, Helvetica;
    text-decoration: none;
    text-shadow: 0 1px 0 #000;
    min-width:80px;
    text-align:center;
}

#themenu li:hover > a {
    color: #fff;
}

*html #themenu li a:hover { /* IE6 only */
    color: #fff;
}
#themenu ul {
    height: auto;
    margin: 20px 0 0 0;
    _margin: 0; /*IE6 only*/
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 25px;
    left: 0;
    z-index: 1000;    
    {*background: linear-gradient(#d60a1b,#d60a1b,#d60a1b, #fff);*}
    box-shadow: 0 -1px 0 rgba(255,255,255,.3);  
    border-radius: 3px;

    transition: all .2s ease-in-out;  
        -moz-transition: all .2s ease-in-out; /* Firefox 4 */
        -webkit-transition: all .2s ease-in-out; /* Safari and Chrome */
        -o-transition: all .2s ease-in-out; /* Opera */
        -ms-transition: all .2s ease-in-out;; /* IE9 (maybe) */

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

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

#themenu ul ul {
    top: 0;
    left: 150px;
    margin: 0 0 0 20px;
    _margin: 0; /*IE6 only*/    
}

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

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

#themenu ul a {    
    padding: 7px;
    padding-right: 30px;
    min-width: 130px;
    _height: 10px; /*IE6 only*/
    display: block;
    white-space: nowrap;
    float: none;
    text-transform: none;
}

#themenu ul a:hover {
    background-color: #d60a1b;
    background-image: linear-gradient(#fff, #d60a1b);
}
#themenu ul li:first-child > a {
    border-radius: 3px 3px 0 0;
}

#themenu ul li:first-child > a:after {
    content: '';
    position: absolute;
    left: 40px;
    top: -6px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #d60a1b;

}

#themenu ul ul li:first-child a:after {
    left: -6px;
    top: 50%;
    margin-top: -6px;
    border-left: 0; 
    border-bottom: 6px solid transparent;
    border-top: 6px solid transparent;
    border-right: 6px solid #3b3b3b;
}

#themenu ul li:first-child a:hover:after {
    border-bottom-color: #04acec; 
}

#themenu ul ul li:first-child a:hover:after {
    border-right-color: #0299d3; 
    border-bottom-color: transparent;   
}

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

/* ------------------------- Mobile --------------------------*/
.no-transition {
    transition: none;
    opacity: 1;
    visibility: visible;
    display: none;      
}

#themenu li:hover > .no-transition {
    display: block;
}

/* ------------------------- Mobile end --------------------------*/

#menuimg {
    height:0px;
    width:100%;
    float:left;
    margin-top:-110px;
    -moz-transition: all .2s ease-in-out; 
    -webkit-transition: all .2s ease-in-out;  
    -ms-transition: all .2s ease-in-out;  
    -o-transition: all .2s ease-in-out;  
    transition: all .2s ease-in-out; 
    opacity:0;
    filter:alpha(opacity=0);
}

#themenu li:hover > div {
    height:80px;
    margin-top:-80px;
    opacity:1;
    filter:alpha(opacity=100);
}
#menuimage {
        height: 22px;
        width: 15px;
        float: left;
        background: url(/uploads/ffg_neu/fflogo.png);
        background-size: cover;
        margin-right: 5px;
}

#menuimage1 {
        height: 12px;
        width: 15px;
        float: left;
        background: url(/uploads/ffg_neu/arrow.gif);
        background-size: cover;
        margin-right: 5px;
}

请查看我的(德国)网站http:// feuerwehr.greifenburg.net自行测试。

任何人都可以给我一个提示,这里发生了什么?我一直在寻找这个问题的解决方案,并花了很多时间,但直到我还没有找到一个。

0 个答案:

没有答案