0

在使用下拉菜单中的链接获取下拉菜单位置或主要是其背景到位时遇到一些问题,无法弄清楚可能是什么问题......这是关于如何使用的 CSS 代码 (menu li ul) 图像它看起来 -> http://i.imgur.com/9VjpW.jpg或 jsFiddle http://jsfiddle.net/F5wCG/3/

.menu ul{
background-color: transparent;
height: 25px;
list-style: none;
margin: 0;
padding: 0;
position: relative;
clear: left;
float: right;
text-align: center;
right: 50%;

}
.menu li{
    float: left;
    padding: 0px;
    position: relative;
    left: 50%;
    margin: 0px;
    list-style: none;
    }

.menu li a{ /* Where main link names are etc */
    background: #333 url("images/seperator.gif") bottom right no-repeat;
    color: #CCC;
    display: block;
    font-weight: normal;
    line-height: 35px;
    margin: 0px;
    padding: 0px 25px;
    text-align: center;
    text-decoration: none;
    }

    .menu li a:hover, .menu ul li:hover a{
        background-color: #2580A2;
        background-image: url('images/hover.gif');
        background-position: bottom center;
        background-repeat: no-repeat;
        color:#FFFFFF;
        text-decoration:none;
        }

.menu li ul{ /* Drop down menu */
    background-color: #333;
    display: none;
    height: auto;
    border: 0px;
    position: absolute;
    width: 225px;
    z-index: 200;
    padding: 0px;
    margin: 0px;
    border: 0px;
    }

.menu li:hover ul{
    display: block;
    }

.menu li li {
    background: url('images/sub_sep.gif') bottom left no-repeat;
    display: block;
    float: none;
    width: 220px;
    }

.menu li:hover li a{
    background: none;

    }

.menu li ul a{
    display: block;
    height: 35px;
    font-size: 12px;
    font-style: normal;
    margin: 0px;
    padding: 0px 10px 0px 15px;
    text-align: left;
    }

    .menu li ul a:hover, .menu li ul li:hover a{
        background: #2580A2;
        background-image: url(images/hover_sub.gif);
        background-position: center left;
        background-repeat: no-repeat;
        border: 0px;
        color: #FFF;
        text-decoration: none;
        }

.menu p{
    clear: left;
    }
4

1 回答 1

1

http://jsfiddle.net/F5wCG/4/

基本上删除 .menu li { left: 50% } 并添加 .menu li a {left:0; }

于 2012-04-06T21:20:01.933 回答