使col center Bootstraps

时间:2018-01-08 03:14:40

标签: html css twitter-bootstrap

我在一行内创建了一个“col-lg-6文本中心”,但它只在列本身内居中。所以我必须再添加2列“col-lg-3”以使col-6位于页面的中心。

 <div class="row">
             <div class="col-lg-3">

             </div>
             <div class="col-lg-6 text-center">
                  <p>Some text</p>
             </div>
             <div class="col-lg-3">

             </div>
</div> 

你们有没有办法让col-lg-6在没有2 col-lg-3的页面中居中?我很感激。

1 个答案:

答案 0 :(得分:2)

使用col-lg-offset-3在左侧添加3列的偏移量

Plunker解决方案:

https://plnkr.co/edit/B5Ka3V7BHio0v8ZcMcXr

<div class="row"> 
         <div class="col-lg-offset-3 col-lg-6 text-center">
              <p>Some text</p>
         </div>
</div> 
相关问题