0

I have the next HTML structure:

<div class="container">
    <div class="row">
        <div class="col-12 col-sm-12 col-lg-4 col-md-4">
            <div class="title">Some title</div>
                <ul>
                    <li>test 1</li>
                    <li>test 2</li>
                </ul>
            </div>
        </div>

        <div class="col-12 col-sm-12 col-lg-4 col-md-4">
            <div class="title">Some long title </div>
                <ul>
                    <li>test 1</li>
                    <li>test 2</li>
                </ul>
            </div>
        </div>

        <div class="col-12 col-sm-12 col-lg-4 col-md-4" >
            <div class="title">Some very very long title</div>
            <ul>
                <li>test 1</li>
                <li>test 2</li>
            </ul>
        </div>
    </div>
</div>

I need each of the div.title blocks to be equal in height to the highest. How I can do it?

VeeXit
  • 79
  • 1
  • 1
  • 4
  • Possible duplicate of [How can I make Bootstrap columns all the same height?](https://stackoverflow.com/questions/19695784/how-can-i-make-bootstrap-columns-all-the-same-height) – Ömürcan Cengiz Oct 08 '19 at 21:52
  • 1
    The columns already are the same height (https://www.codeply.com/go/CpxjpH1nja) and the HTML you posted is malformed – Carol Skelly Oct 08 '19 at 22:21

2 Answers2

0

I think the best way to do this is to use a table, since these can automatically align multiple columns. Bootstrap itself can't make multiple titles the same high in the HTML structure you've provided.

Also, you're closing div-tags twice, please see this example for a fixed version. You're trying to close the title-divs twice, like this:

            <div class="title">Some long title </div>
                <ul>
                    <li>test 1</li>
                    <li>test 2</li>
                </ul>
            </div>

while you should only close a tag once, since the current code will do weird things in different browsers.

Tim
  • 551
  • 3
  • 23
0

You can use this code

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <title>Hello, world!</title>
    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
        }
        .box {
            background-color: #dddddd;
            padding: 20px;
        }
        .box h1 {
            font-size: 20px;
            font-weight: 700;
        }
        .box ul {
            margin: 0;
            padding: 0;
        }
        .box ul li {
            margin: 0;
            padding: 0;
            list-style-type: none;
        }
        .box ul.bottom {
            padding-bottom: 60px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-12 col-lg-4 col-md-4 col-sm-12">
                <div class="box">
                    <h1 class="title">Some title</h1>
                    <ul class="bottom">
                        <li>test 1</li>
                        <li>test 2</li>
                    </ul>
                </div>
            </div>
            <div class="col-12 col-lg-4 col-md-4 col-sm-12">
                <div class="box">
                    <h1 class="title">Some long title</h1>
                    <ul>
                        <li>test 1</li>
                        <li>test 2</li>
                    </ul>
                </div>
            </div>
            <div class="col-12 col-lg-4 col-md-4 col-sm-12">
                <div class="box">
                    <h1 class="title">Some very very long title</h1>
                    <ul>
                        <li>test 1</li>
                        <li>test 2</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <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.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
Piyush Teraiya
  • 739
  • 4
  • 7