使用bootstrap css将两个div水平并排居中对齐页面 [英] Align two divs horizontally side by side center to the page using bootstrap css

查看:2471
本文介绍了使用bootstrap css将两个div水平并排居中对齐页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参考以下代码我尝试过的内容

Please refer below code what i tried

<div class="row">
  <div class="center-block">First Div</div>
  <div class="center-block">Second DIV </div>
</div>

输出:

First Div
SecondDiv

预期输出:

                      First Div        Second Div

我想使用引导CSS将两个div水平居中对齐到页面.我怎样才能做到这一点 ?我不想使用简单的CSS和浮动概念来做到这一点.因为我需要使用bootstrap css来处理所有类型的布局(即所有窗口大小和分辨率),而不是使用媒体查询.

i want to align the two divs horizontally center to page using bootstrap css. how can i do this ? i dont want to use simple css and floating concept to do this. because i need to make use of the bootstrap css to work in all kind of layouts (i.e. all window size and resolutions ) instead of using media query.

推荐答案

这应该可以解决问题:

<div class="container">
    <div class="row">
        <div class="col-xs-6">
            ONE
        </div>
        <div class="col-xs-6">
            TWO
        </div>
    </div>
</div>

已阅读Bootstrap文档的网格系统部分,以熟悉Bootstrap网格的工作方式:

Have a read of the grid system section of the Bootstrap docs to familiarise yourself with how Bootstrap's grids work:

http://getbootstrap.com/css/#grid

这篇关于使用bootstrap css将两个div水平并排居中对齐页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆