简体   繁体   English

CSS HTML IE7(UL和LI标签)菜单问题

[英]css html ie7 (ul and li tags) menu problem

I m having trouble with some code and the ie7 browser, its a vertical CATEGORY menu made with the ul tag, and css properties. 我在使用一些代码和ie7浏览器,用ul标签制成的垂直CATEGORY菜单以及CSS属性时遇到麻烦。 Works fine with safari, ie8, firefox 3.5 and 3.6 but with ie7 A BIG LEFT MARGIN IS BEING CREATED This is the code that is being generated by the server: 与safari,ie8,firefox 3.5和3.6兼容,但与ie7一起正常工作正在创建大容量保证金这是服务器生成的代码:

    <div id="menu">  
    <ul><li><a class="level1" href="catalog.html?category=21">PRODUCTOS</a></li>  
<li><a class="level1" href="catalog.html?category=21">Daniela Kosan</a></li>  
<li><a class="level2" href="catalog.html?category=21">Lo Nuevo</a></li>  
<li><a class="level2" href="catalog.html?category=22">Fragancias</a></li>  
<li><a class="level2" href="catalog.html?category=23">Rostro</a></li>  
<li><a class="level2" href="catalog.html?category=24">Accesorios</a></li></ul>
    </div>

and this is the css i'm using: 这是我正在使用的CSS:

*{ margin-top:0; * {margin-top:0; padding:0; 填充:0; } }

#menu{
    background:#fff;
    width:205px;

    padding-left:9px;

}
    #menu ul{
        list-style:none;


    }
        #menu li{
            list-style:none;


        }
            #menu li a{
                list-style:none;
                font-family: arial, sans-serif;
                background:#F0CFD6;
                color:#944862;
                text-transform:none;
                font-size:14px;
                font-weight:normal;
                text-decoration:none;
                display:block;


            }
                #menu li a:hover{
                    color:#fff;
                    text-decoration:none;
                }
            #menu li a.level1{
                padding-left:10px;
                padding-top:10px;
                width:205px;
                height:20px;
                color:#fff;
                background:#DA8298;


            }
                #menu li a:hover.level1{
                    color:#000;
                }
            #menu li a.level2{
                padding-left:20px;
                padding-top:12px;
                width:205px;
                height:20px;
                color:#8B5169;
                border-width:0 0px 0px 0px;
                background:#F0CFD6;
                border-bottom:1px dashed #CEABB2;

            }
                #menu li a:hover.level2{
                    color:#000;
                }

Here is the bad render, NOTE THE BIG LEFT MARGIN BESIDES THE CATEGORY MENU 这是较差的渲染,请注意“大余量”位于“类别”菜单之外 替代文字

This is how it renders on the other browsers... good! 这就是它在其他浏览器上的呈现方式...好! Thank you guys! 感谢大伙们! 替代文字

Try setting the margin and padding on the ul . 尝试在ul上设置边距和填充。 Different browser will automatically set it to different things. 不同的浏览器会自动将其设置为不同的内容。 I suggest using a CSS reset in the future. 我建议将来使用CSS重置

#menu ul {
    margin-left: 0px;
    padding-left: 0px;
    }

Try the above and let me know if it works. 尝试上述操作,并让我知道它是否有效。 I don't have IE, so I can't test it. 我没有IE,所以无法测试。 I'd test the margin and padding one at a time to see if only one of them is the culprit. 我测试margin和padding一次一个,看看其中只有一个是罪魁祸首。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM