围绕导航栏 [英] Centering the Navigation bar

查看:99
本文介绍了围绕导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个无序列表,并使用精灵标准的导航栏。林还使用jQuery呈现一些动画。一切工作正常。我有定心酒吧的一个问题。它被放置在左边。中心但这并不工作:​​我已经使用文本对齐尝试。我认为有冲突的属性。可以ü家伙请帮我中心呢?我不是什么大不了的UI开发!

  .navbar {
 列表样式类型:无;
 列表样式位置:外部;
 位置:亲属;
 保证金:0;
 填充:0; }

.navbar李{
显示:块;
溢出:隐藏;
填充:0;
光标:指针;
浮动:左;
宽度:125px;
高度:40PX;
保证金右:0px;
背景图像:网址(sprite.jpg);
背景重复:不重复;

}
.navbar一个{
显示:块;
高度:40PX;
文本缩进:-9999px;
概述:无;

}
 

解决方案

您是否尝试过这个?

 保证金左:自动;
保证金权:汽车;
 

还是这样呢?

 保证金左:0px;
保证金右:0px;
 

hey guys, I have a standard nav bar with an unordered list and using sprites. Im also using jquery to render some animation. Everything works fine. I have a problem with centering the bar. It is aligned to the left. I've tried using text-align:center but this doesnt work. I think there are conflicting properties. Could u guys please help me center it? Im not that big a UI developer!

.navbar {
 list-style-type: none;
 list-style-position:outside;
 position: relative;
 margin: 0;
 padding: 0; }

.navbar li{
display: block;
overflow: hidden;
padding: 0;
cursor: pointer;
float: left;
width: 125px;
height: 40px;
margin-right: 0px;
background-image:url(sprite.jpg);
background-repeat:no-repeat;

}
.navbar a{
display:block;
height:40px;
text-indent:-9999px;
outline:none;

}

解决方案

Have you tried this?

margin-left: auto;
margin-right: auto;

Or something like this?

margin-left: 0px;
margin-right: 0px;

这篇关于围绕导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆