Html 无法在引导程序中“向右拉”图标字形

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17949697/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:39:46  来源:igfitidea点击:

Can't "pull-right" icon glyph in bootstrap

csshtmltwitter-bootstrap

提问by Toan Nguyen

I want to pull right icon glyph in drop down menu like as below

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

<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>

But when I run this code on FireFox (Chrome and IE are oke), "icon-arrow-right" and "2-level Dropdown" aren't same a line . How can I fix it ?

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

Full code on JSFIDDLE

JSFIDDLE 上的完整代码

采纳答案by David Taiaroa

The solution from cetverworks well for me.

cetver的解决方案对我来说效果很好。

For the record though, here's another way to get the same results:
http://www.bootply.com/70536

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

HTML

HTML

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

CSS

CSS

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

回答by cetver

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

jsfiddle

提琴手