CSS 导航菜单文本在大小方面罕见的行为,如何与底部对齐
有问题的页面位于以下地址:
http://richiesportfolio.com/temp-site-tester/index.html< /a>
正如您所看到的,图像与导航菜单的顶部对齐,但如果我将文本放入链接中,文本将变为导航菜单的高度并与底部对齐。我不知道这是怎么发生的。
这是一些 CSS,其余的你可以查看我给你的链接的页面源代码。
body, html { background: #e6f3f7; text-align: center; height: 100%; font-face:Verdana, Geneva, sans-serif; }
#page_wrapper {
background: url(images/bg_slice.jpg) repeat-x #e6f3f7;
}
.page {
margin:0 auto;
width: 1000px;
overflow: hidden;
padding-bottom: 35px;
}
#page {
background: url(images/header.jpg) no-repeat #e6f3f7;
overflow: hidden;
}
#nav {
height: 55px;
margin-top: 150px;
list-style: none;
}
#nav li{
display: inline;
}
#nav li img {
margin:0 10px;
}
#nav li a {
font-size: 24px;
margin-left: 10px;
margin-right: 10px;
margin-top:0px;
color: #fff;
}
#nav li.current a {
}
#nav li a:hover {
}
span {
font-family: Myriad Pro;
font-weight: bold;
margin-top:0;
}
h1 { margin: 35px;
color:#022c4d;
}
p { margin-left:35px;
color:#6492a3;}
#content {
margin: 150px auto;
}
#column1 {
float:left;
width:650px;
background: url(images/content_bg.png);
height:650px;
text-align:left;
}
#column2 {
float:left;
width:277px;
margin-left:50px;
}
The page in question is at the following address:
As you can see the images align to the top of the nav menu but if I put text in the link the text becomes the height of the nav menu and aligns to the bottom. I have no idea how this is happening.
Here is some of the CSS the rest you can just view the page source of the link I gave you.
body, html { background: #e6f3f7; text-align: center; height: 100%; font-face:Verdana, Geneva, sans-serif; }
#page_wrapper {
background: url(images/bg_slice.jpg) repeat-x #e6f3f7;
}
.page {
margin:0 auto;
width: 1000px;
overflow: hidden;
padding-bottom: 35px;
}
#page {
background: url(images/header.jpg) no-repeat #e6f3f7;
overflow: hidden;
}
#nav {
height: 55px;
margin-top: 150px;
list-style: none;
}
#nav li{
display: inline;
}
#nav li img {
margin:0 10px;
}
#nav li a {
font-size: 24px;
margin-left: 10px;
margin-right: 10px;
margin-top:0px;
color: #fff;
}
#nav li.current a {
}
#nav li a:hover {
}
span {
font-family: Myriad Pro;
font-weight: bold;
margin-top:0;
}
h1 { margin: 35px;
color:#022c4d;
}
p { margin-left:35px;
color:#6492a3;}
#content {
margin: 150px auto;
}
#column1 {
float:left;
width:650px;
background: url(images/content_bg.png);
height:650px;
text-align:left;
}
#column2 {
float:left;
width:277px;
margin-left:50px;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是
#nav li
及其display: inline;
我建议您看看这个..这是使菜单居中的好方法。 (在大多数情况下..)
http: //matthewjamestaylor.com/blog/beautiful-css-centered-menus-no-hacks-full-cross-browser-support
I'ts the
#nav li
and itsdisplay: inline;
I would suggest you look at this.. this is a good way of centering your menu. ( in most cases.. )
http://matthewjamestaylor.com/blog/beautiful-css-centered-menus-no-hacks-full-cross-browser-support