填充似乎不起作用

时间:2012-08-18 12:52:18

标签: css padding

Padding似乎无法正常工作。 在悬停时,填充物从容器中出来。 谁能告诉我为什么会这样? 填充必须在菜单之间留出空白,但不是,而是在悬停时,填充物从容器中出来。

http://ashwin931996.webege.com

3 个答案:

答案 0 :(得分:0)

不明白你想要取得什么...... 无论如何,如果你添加到导航a:将鼠标悬停:

display: inline-block

这是你想要的效果吗?

答案 1 :(得分:-1)

你在css中犯了一个小小的错误,你可以完美地改变它的工作。 如下;

#nav a {
color: #000000;
padding: 0 20px 0 30px;
text-decoration: none;
}

#nav a:hover {
padding: 0 20px 0 30px;
}

答案 2 :(得分:-1)

必须重写CSS的某些部分,填充实际上就是你,但你需要给一个标签一个display:block;但是,一旦我这样做,它就混淆了所有东西,所以我清理了我所制造的混乱。希望你喜欢。 P.S这是在Mozilla中测试的,Firefox可能想在其他浏览器中试用它。

@font-face {
    font-family: "rbno2_light_alternative_Rg";
    font-style: normal;
    font-weight: normal;
    src: url("../fonts/rbno2light_a-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/-webfont.woff") format("woff"), url("../fonts/rbno2light_a-webfont.ttf") format("truetype"), url("../fonts/rbno2light_a-webfont.svg#rbno2_light_alternative_Rg") format("svg");
}
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
    -x-system-font: none;
    border-bottom-color: -moz-use-text-color;
    border-bottom-style: none;
    border-bottom-width: 0;
    border-left-color-ltr-source: physical;
    border-left-color-rtl-source: physical;
    border-left-color-value: -moz-use-text-color;
    border-left-style-ltr-source: physical;
    border-left-style-rtl-source: physical;
    border-left-style-value: none;
    border-left-width-ltr-source: physical;
    border-left-width-rtl-source: physical;
    border-left-width-value: 0;
    border-right-color-ltr-source: physical;
    border-right-color-rtl-source: physical;
    border-right-color-value: -moz-use-text-color;
    border-right-style-ltr-source: physical;
    border-right-style-rtl-source: physical;
    border-right-style-value: none;
    border-right-width-ltr-source: physical;
    border-right-width-rtl-source: physical;
    border-right-width-value: 0;
    border-top-color: -moz-use-text-color;
    border-top-style: none;
    border-top-width: 0;
    font-family: inherit;
    font-size: inherit;
    font-size-adjust: inherit;
    font-stretch: inherit;
    font-style: inherit;
    font-variant: inherit;
    font-weight: inherit;
    line-height: inherit;
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
    vertical-align: baseline;
}
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style-image: none;
    list-style-position: outside;
    list-style-type: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
#logo {
    float: left;
    margin-top: 27%;
    width: 372px;
}
#logo h1 {
    background-color: #FFFFFF;
    display: block;
    font-family: rbno2_light_alternative_Rg;
    font-size: 2.5em;
    letter-spacing: 0.3em;
    padding-bottom: 2%;
    padding-left: 1%;
    padding-right: 2%;
    padding-top: 2%;
    width: 432px;
}
#nav {
    display: block;
    float: left;
    margin-top: 16%;
    width: 100%;
}
#nav ul {
    background-color: #FFFFFF;
    display: block;
    float: left;
    list-style-image: none;
    list-style-position: outside;
    list-style-type: none;
    width: 100%;
}
#nav ul li {
    color: #000000;
    display: block;
    float: left;
    font-family: rbno2_light_alternative_Rg;
    font-size: 1.9em;
}
#nav a {
    color: #000000;
    display: block;
    padding-bottom: 1em;
    padding-left: 3em;
    padding-right: 3em;
    padding-top: 1em;
    text-decoration: none;
}
#nav a:hover {
    background-color: #000000;
    color: white;
}