带有图像的页面末尾的Bootstap col

时间:2018-11-01 16:31:30

标签: html bootstrap-4

我有一个通过引导程序4创建的html页面。

我希望将col分为两部分,每个部分都有特定的背景色,中间是图像。我希望有this

但是我可以做this

我的代码是

 

    <div class="col-sm-2" id="s1" style="padding-top: 12rem">
    <div class="text-center">
        <div class="container">
            <div class="row" style=" min-height: 100%">
                <div class="col-sm-6  no-float" style="background-color: #1e7e34; min-height: 100%">
                    One of three columns
                </div>
                <div class="col-sm-6  no-float" style="background-color: silver; min-height: 100%">
                    One of three columns
                </div>
            </div>
        </div>

    </div>
    <img src="Image.png" style="max-width:80%; max-height:80%;" align="center">
</div>

高度是图像,但是每页图像都会改变,因为最终用户可以插入图像。

你有个主意吗?

1 个答案:

答案 0 :(得分:0)

也许您可以在引导程序类中添加图像。它使图像在该列的中间对齐

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

    <div class="col-sm-2" id="s1" style="padding-top: 12rem">
    <div class="text-center">
        <div class="container">
            <div class="row" style=" min-height: 100%">
                <div class="col-sm-6  no-float" style="background-color: #1e7e34; min-height: 100%">
                    One of three columns
                </div>
                <div class="col-sm-6  no-float" style="background-color: silver; min-height: 100%">
                    One of three columns
                </div>
            </div>
        </div>

    </div>
    <img class="d-block mx-auto" src="Image.png" style="max-width:80%; max-height:80%;" align="center">
</div>