html - Bootstrap 网格填充页面宽度和高度

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

我有以下 4 个正方形(两行两列):

<section id="gallery">
  <div class="container-fluid">
        <div class="row">
            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">                    
                 <div style="background-image: url(http://placehold.it/675x400)">&nbsp;
                 </div>
            </div>
            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">                    
                <div style="background-image: url(http://placehold.it/675x400)">&nbsp;
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">                    
                <div style="background-image: url(http://placehold.it/675x400)">&nbsp;
                </div>
            </div>
            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">                    
                <div style="background-image: url(http://placehold.it/675x400)">&nbsp;
                </div>
            </div>
        </div>
    </div>
</section>

我希望它们以 4 个方形的方式显示,并且网格占据页面的整个宽度和高度。我还希望它能够响应并且我不希望每个方 block 之间有任何空格。

我试过像这样在我的部分标签上设置 css:

section
{
  height: 100vh;
}

但是那没有效果。请问有人知道如何实现吗?

谢谢

最佳答案

试试这个作为 CSS

section#gallery
{
    height:100%;
    width:100%;
}

div.row
{
    height:50%;
}

div.col-lg-6.col-md-6.col-sm-6.col-xs-12
{
    width:50%;
}

关于html - Bootstrap 网格填充页面宽度和高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35375825/

相关文章:

php - CSS 样式没有应用到我的论坛 任何人都知道为什么?

html - .asp 无法识别 : 500 - Internal server error

html - <div> 如何扩展其 <li> 父元素的长度?

javascript - Bootstrap 导航栏搜索表单输入具有未应用的错误类

ajax - X-Editable - 提交旧值

javascript - Slickgrid 移动外观

javascript - 设置 Blueimp 照片库的困难

php - CSS 类未反射(reflect)在表中

javascript - 单击折线图中的单个点但不单击条形图中的单个条时显示 Bootstrap 模式

Jquery slider 空间/边距问题