Bootstrap 3水平对齐文本和div中间的跨度

时间:2014-08-07 23:36:34

标签: html css twitter-bootstrap twitter-bootstrap-3

enter image description here

我正在尝试将Back To Top和上方克拉对齐在div container的中间,但我似乎无法让它发挥作用。

我正在使用Bootstrap 3。如何让它在中间正确对齐?

HTML

<div class="container-fluid" id="footer">
    <a href="#" class="center-block">
        <p class="text-center" id="back-to-top">Back To Top</p><span class="glyphicon glyphicon-chevron-up"></span>
    </a>
    <p class="text-center" id="copyright">© 2014 LFDate. All rights reserved.</p>
</div>

CSS

#back-to-top {
display: inline;
margin-right: 10px;
}

1 个答案:

答案 0 :(得分:0)

您似乎以非传统方式包裹您的元素(即<p>内的<a>

我提出了一种不同的方法:

<div class="container-fluid" id="footer">
    <a href="#" class="center-block">
        <span class="glyphicon glyphicon-chevron-up"></span> Back To Top
    </a>
    <p class="text-center" id="copyright">
      © 2014 LFDate. All rights reserved.
  </p>
</div>

<强> CSS

#footer{
  display: table;
}
#copyright {  
  display:table-cell;
  padding: 10px;
}

<强> See Demo

相关问题