[英]Center align LI when there is Float left
Folllowing is my jsfiddle in which I am trying to center align the list items <li>
into <ul>
. 跟随是我的jsfiddle,在其中我试图将列表项<li>
居中对齐到<ul>
。 Only problem is lis are set to float left and I can not remove this condition . 唯一的问题是lis设置为向左浮动,我无法删除此情况 。 Kindly let me know is there a way to tackle float left and make lis center aligned generically (in responsive manner)? 请让我知道是否有一种方法可以解决浮动问题并使lis中心一般地对齐(以响应方式)?
http://jsfiddle.net/AqRJA/2/ http://jsfiddle.net/AqRJA/2/
#nav{
text-align: center;
line-height:30px;
}
#nav li {
float: left;
}
#nav li {
list-style:none;
margin: 0 5px;
display:inline;
border:gray solid 1px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.