在引导程序中不能“拉右”图标字形

时间:2013-07-30 14:22:17

标签: css html5 twitter-bootstrap

我想在下拉菜单中拉出右图标字形,如下所示

<div class="navbar">
  <div class="navbar-inner">
    <ul class="nav">
      <li class="dropdown">
        <a data-toggle="dropdown" class="dropdown-toggle" href="#">Dropdown <b class="caret"></b></a>
        <ul class="dropdown-menu">
          <li>
            <a href="#">2-level Dropdown <i class="icon-arrow-right pull-right"></i></a>
            <ul class="dropdown-menu sub-menu">
              <li><a href="#">Action</a></li>
              <li><a href="#">Another action</a></li>
              <li><a href="#">Something else here</a></li>
            </ul>
          </li>
          <li><a href="#">Another action</a></li>
          <li class="divider"></li>
          <li><a href="#">One more separated link</a></li>
        </ul>
      </li>
    </ul>
  </div>
</div>

但是当我在FireFox上运行此代码时(Chrome和IE是oke),“icon-arrow-right”和“2-level Dropdown”不一样。我该如何解决?

Full code on JSFIDDLE

2 个答案:

答案 0 :(得分:18)

<a href="#" style="overflow: hidden;">
    <span class="pull-left">2-level Dropdown</span>
    <span class="icon-arrow-right pull-right"></span>
</a>

jsfiddle

答案 1 :(得分:7)

来自cetver的解决方案对我很有用。

对于记录,这是获得相同结果的另一种方法:
http://www.bootply.com/70536

HTML

<a href="#"><i class="icon-arrow-right"></i> 2-level Dropdown</a>  

CSS

.icon-arrow-right {
float: right;
margin-top: 2px;
margin-right: -6px;
}