Css 我的下拉链接旁边有10像素的透明空间

Css 我的下拉链接旁边有10像素的透明空间,css,Css,我目前正在处理导航栏。我遇到的一个问题是,当我在主导航.navi ul中添加10px的填充时,每个菜单项下的所有下拉项都添加了10px的净空间,我就是不明白为什么。您可以在此处看到这一点: 这是我的CSS: .navi { background: #222; /* Show a solid color for older browsers */ background: -moz-linear-gradient(#252525, #0a0a0a); background:

我目前正在处理导航栏。我遇到的一个问题是,当我在主导航
.navi ul
中添加10px的填充时,每个菜单项下的所有下拉项都添加了10px的净空间,我就是不明白为什么。您可以在此处看到这一点:

这是我的CSS:

.navi {
    background: #222; /* Show a solid color for older browsers */
    background: -moz-linear-gradient(#252525, #0a0a0a);
    background: -o-linear-gradient(#252525, #0a0a0a);
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#252525), to(#0a0a0a)); /* older webkit syntax */
    background: -webkit-linear-gradient(#252525, #0a0a0a);
    clear: both;
    display: block;
    float: left;
    margin: 0 auto 6px;
    width: 100%;
}

.navi ul {
    font-size: 13px;
    list-style: none;
    margin: 0 0 0 -0.8125em;
    padding-left: 10px;
}

.navi li {
    float: left;
    position: relative;
}

.navi a {
    color: #eee;
    display: block;
    line-height: 3.333em;
    padding: 0 1.2125em;
    text-decoration: none;
    font-weight: bold;
}

.navi ul ul {
    -moz-box-shadow: 0 3px 3px rgba(0,0,0,0.2);
    -webkit-box-shadow: 0 3px 3px rgba(0,0,0,0.2);
    box-shadow: 0 3px 3px rgba(0,0,0,0.2);
    display: none;
    float: left;
    margin: 0;
    position: absolute;
    top: 3.333em;
    left: 0;
    width: 188px;
    z-index: 99999;
}

.navi ul ul ul {
    left: 100%;
    top: 0;
}

.navi ul ul a {
    background: #f9f9f9;
    border-bottom: 1px dotted #ddd; color: #444;
    font-size: 13px;
    font-weight: normal;
    height: auto;
    line-height: 1.4em;
    padding: 10px 10px;
    width: 188px;
}

.navi li:hover > a,
.navi ul ul :hover > a,
.navi a:focus {
    background: #efefef;
}

.navi li:hover > a,
.navi a:focus {
    background: #f9f9f9; /* Show a solid color for older browsers */
    background: -moz-linear-gradient(#f9f9f9, #e5e5e5);
    background: -o-linear-gradient(#f9f9f9, #e5e5e5);
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f9f9f9), to(#e5e5e5)); /* Older webkit syntax */
    background: -webkit-linear-gradient(#f9f9f9, #e5e5e5);
    color: #373737;
}

.navi ul li:hover > ul {
    display: block;
}

.navi
.current-menu-item > a,
.navi .current-menu-ancestor > a,
.navi .current_page_item > a,
.navi .current_page_ancestor > a {
    font-weight: bold;
}

任何帮助都将不胜感激

应用于
.navi ul
的css也适用于嵌套的
ul

.navi ul {
    padding-left: 10px;
}
解决此问题的一种方法:

.navi ul ul {
    padding-left: 0px;
}
或:


非常感谢你!这解决了问题!:-)时间一到,我就检查你的答案@Noelle我很高兴,我添加了第二个选项,因为我不确定ul的嵌套深度。
.navi ul {
    font-size: 13px;
    list-style: none;
    margin: 0 0 0 0;
}