Bootstrap 4一列溢出,最大高度基于第二列

时间:2019-02-26 11:37:10

标签: html css bootstrap-4

在提供的代码段中,column1的高度应等于column2,column2的最大高度应由其内容确定,就像现在一样。如果column1的内容意味着滚动条的内容比column2长/更短,则column1应该溢出以添加滚动条。如何才能做到这一点?谢谢。

/* CSS used here will be applied after bootstrap.css */#div1 {
    background-color: red;
}

#div2 {
    background-color: orange;
}

#column1 {
    background-color: green;
    overflow: auto;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>

<div id="div1" class="container">
    <div id="div2" class="row">
        <div id="column1" class="col">
                Words
                <br>Words
                <br>Words
                <br>Words
                <br>Words
                <br>Words
                <br>Words
                <br>Words
                <br>Words
                <br>Words
                <br>Words
                <br>Words
                <br>Words
                <br>Words
        </div>
        <div id="column2" class="col">
            Words
            <br>Words
            <br>Words
            <br>Words
            <br>Words
            <br>Words
            <br>Words
            <br>Words
            <br>Words
            <br>Words
            <br>Words
        </div>
    </div>
</div>

0 个答案:

没有答案