如何在使用引导程序布局时垂直居中对齐div

时间:2017-12-18 04:16:51

标签: html css

我有以下代码段:



#content{
    text-align: center;
    vertical-align: middle;
}

<body>
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <div id="content">
                    <h1>Sample Text</h1>
                    <h3>Subtext to the intro to the site</h3>
                    <hr>
                    <button class="btn btn-default btn-lg">Get Started!</button>
                </div>
            </div>
        </div>
    </div>
</body>
&#13;
&#13;
&#13;

我正在使用Bootstrap的网格系统。我希望能够使用id="content"垂直居中div的内容(基本上我希望整个内容在页面调整大小时水平和垂直居中)。这是一个以图像为背景的启动页面。我怎么能用CSS做到这一点? vertical-align: middle不起作用。

仅仅为了我的学习,text-align: center基本上是任何元素的中心,即使名称似乎表明它是用于文本的吗?

1 个答案:

答案 0 :(得分:0)

enum :kind, [:junior, :senior, :group], prefix: :kind
band.kind_group?