[英]<span> floated inside <li> creates new line in FF but not in Chrome
I'm using twitter-bootstrap for a menu and can't seem to figure out what's up with the message counter span I'm trying to get to float to the right – seems to work in Chrome (bottom) but shoots it down to a new line in FF (top). 我正在使用twitter-bootstrap作为菜单,但似乎无法弄清楚我要浮动到右侧的消息计数器范围是什么-似乎可以在Chrome(底部)中使用,但将其击落到FF中的新行(顶部)。 If I reduce width of the span to 0, it stays on same line, but then is off the edge of the menu. 如果我将跨度的宽度减小为0,则它会保持在同一行,但不在菜单边缘。
Any suggestions would be much appreciated! 我们欢迎所有的建议!
Here's the code: http://codepen.io/anon/pen/lGeJz 这是代码: http : //codepen.io/anon/pen/lGeJz
<ul class="dropdown-menu">
<li><a href="#">Dashboard</a></li>
<li><a href="#">Messages<span class="counter">(306)</span></a></li>
<li><a href="#">Account</a></li>
<li><a href="#">Logout</a></li>
</ul>
CSS: .counter {float: right;}
^^ this is what's happening in the actual page – trying to get counter right aligned... ^^这就是实际页面中发生的–试图使计数器正确对齐...
Remove the float:right;
移除float:right;
. 。
You could create the following css class: 您可以创建以下css类:
.dropdown-menu span.counter {
position:relative;
}
etc. 等等
If you were to align the text left, and the counter right.. I would create two inline div's and float one left, and the other right. 如果要使文本左对齐,则计数器右对齐。我将创建两个内联div,并向左浮动一个,向右浮动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.