为dropdown bootstrap 3添加字体真棒?

时间:2014-09-02 06:54:11

标签: css3 twitter-bootstrap

我在boostrap 3中有这种下拉

 <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-camera-retro fa-2x"></i> Dashboard</a>
            <ul class="dropdown-menu">
              <li><a href="#">Action</a></li>
              <li><a href="#">Another action</a></li>
              <li><a href="#">Something else here</a></li>
              <li class="divider"></li>
              <li><a href="#">Separated link</a></li>
            </ul>
          </li>

问题在于这里txt右侧的图标,我希望文本保持在中间的图标下,图标也在文本顶部的中间,当我在图标下添加长文本thta all stay在中间

这是bootply的工作原理 http://www.bootply.com/ZhwSteTLgw

我需要的是这个

enter image description here

但是,我添加长txt以保持在中间?

UPDATE 溶液

<a href="#" data-toggle="dropdown" class="dropdown-toggle"><i class="fa fa-camera-retro fa-2x"></i><span class="show">Dashboard</span></a>


ul > li > a
{
    text-align:center;
}

2 个答案:

答案 0 :(得分:1)

试试这个:

DEMO

<li class="dropdown">
  <a style="width:auto" href="#" class="dropdown-toggle col-md-12 text-center" data-toggle="dropdown">
    <i class="fa fa-camera-retro fa-2x col-md-12 "></i> <p class="col-md-12 ">Dashboard</p></a>
            <ul class="dropdown-menu">
              <li><a href="#">Action</a></li>
              <li><a href="#">Another action</a></li>
              <li><a href="#">Something else here</a></li>
              <li class="divider"></li>
              <li><a href="#">Separated link</a></li>
            </ul>
          </li>

答案 1 :(得分:0)

<li class="dropdown" style="display: table-caption;">
 <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="margin-left: 18PX;"> 
   <i class="fa fa-camera-retro fa-2x"></i> Dashboard</a>
        <ul class="dropdown-menu" style="">
          <li><a href="#">Action</a></li>
          <li><a href="#">Another action</a></li>
          <li><a href="#">Something else here</a></li>
          <li class="divider"></li>
          <li><a href="#">Separated link</a></li>
        </ul>
      </li>

检查这个