【问题标题】:Moving text position on a nav bar在导航栏上移动文本位置
【发布时间】:2012-07-17 12:04:50
【问题描述】:

更新:好的,我更改了 #access ul 的边距,但现在当我将鼠标悬停在它上面时,它看起来像这样:http://imgur.com/NeUzN

也可以更改页面标题之间的间距(抱歉还在学习css!)

我目前正在设计我的 wordpress 主题,想知道如何将文本向上移动一点以使导航栏居中:http://i.imgur.com/BExiy.png

我也在使用自定义字体。这是我的CSS:

#access {
background: #252525;
display: block;
float: left;
margin: 0 auto;
height: 40px;
}
#access ul {
list-style: none;
margin: -8px -13px -10px -13px;
padding-left: 0;
color:#000;
text-shadow:1px 1px 1px rgba(14,14,14,0.8);
text-transform:uppercase;
font: 24px Giantypo, Arial, Helvetica, sans-serif;
}
#access li {
float: left;
position: relative;
}
#access a {
display: block;
line-height: 2.5em;
padding: 0 1em;
text-decoration: none;
color:#f3f3f3;
}
#access ul ul {
box-shadow: 0 3px 3px rgba(0,0,0,0.2);
-moz-box-shadow: 0 3px 3px rgba(0,0,0,0.2);
-webkit-box-shadow: 0 3px 3px rgba(0,0,0,0.2);
display: none;
float: left;
position: absolute;
top: 2em;
left: 0;
z-index: 99999;
}
#access ul ul ul {
left: 100%;
top: 0;
}
#access ul ul a {
background: #3e5d8c;
line-height: 1em;
padding: .5em .5em .5em 1em;
width: 10em;
height: auto;
}
#access li:hover > a,
#access ul ul :hover > a {
background: #3e5d8c;
}
#access ul ul a:hover {
background: #3e5d8c;
}
#access ul li:hover > ul {
display: block;
}
}

任何帮助都会很棒!

干杯,

斯科特

【问题讨论】:

    标签: css wordpress navigation position


    【解决方案1】:

    无序列表的上边距必须为负值。例如:

    margin: -7px 0 0 0;
    

    【讨论】:

    • 好的,我更改了 #access ul 的边距,但现在当我将鼠标悬停在它上面时,它看起来像这样:imgur.com/NeUzN
    • On #access 删除行高或填充。
    【解决方案2】:

    line-height 设置为等于其height。我相信在#access a 上,但如果没有看到 HTML,我无法确定。如果不亲眼看到它,我就无法知道它的高度。

    【讨论】:

    • 好的,我更改了 #access ul 的边距,但现在当我将鼠标悬停在它上面时,它看起来像这样:imgur.com/NeUzN
    • 我会把它放在我的网站上让你看看。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-28
    • 2014-02-11
    • 2022-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多