用bootstrap写了一个<div class="row">...</div>,如何让这个div在整个浏览器窗口居中?

用bootstrap写了一个
<body>
<header>...</header>
<div id="out" class="container">
<div id="in" class="row">...</div>
</div>
<footer>...</footer>
</body>
如何让id="out"的div占满除<header>和<footer>外的所有区域,并且让id="in"的div在id="out"的div里垂直居中?

内容区域居中
将页面元素设置为 display: block并通过设置margin使其居中。可以作为mixin或class使用。
<div class="center-block">...</div>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-01-02
可以在这个div标签里面写行内样式:<div align="center"></div>。这样它就居中了,望采纳
第2个回答  推荐于2016-03-06

垂直居中?怎么个垂直居中法?是不是水平居中啊?

<body>
    <header  style="background:#f90;color:#fff;">header</header>
    <div id="out" class="container" style="background:#f00;width:100%;color:#fff;">
        <div id="in" class="row"  style="background:#600;width:80%; margin:0 auto;height:500px;color:#fff;">id="in"</div>
    </div>
    <footer  style="background:#f90;color:#fff;">footer</footer>
</body>

你试试这个,如果是垂直居中你再发个示意图看看

本回答被提问者和网友采纳
相似回答