You are using Bootstrap 4, right? Bootstrap 4 implements flexbox by default, and you can solve it very simply using pure classes. Bootstrap 4 provides:
<div class="container"> <div class="row"> <div class="col-sm-8 col-8 black"> <p>Bar Graph or Line Graph</p> </div> <div class="col-sm-4 col-4 d-flex align-content-around flex-wrap"> <div class="red"> <p>numbers and more and so on and on and on</p> </div> <div class="purple"> <p>numbers</p> </div> <div class="green"> <p>numbers</p> </div> <div class="blue"> <p class="mb-0">numbers</p> </div> </div> </div> </div>
JS Script Link: https://jsfiddle.net/ydjds2ko/
More details:
You do not need the row-eq-height class (it is not in Bootstrap4 anyway), since equal height is by default.
The first div with class col-sm-8 has the correct height, it just doesn't appear on a black background, because the inner div has its own height. I just deleted the inner div and added the black class to col. If you need an inner div, give it a class (Bootstrap4) h-100 that adjusts the height to the parent element.
div with class col-sm-4 gets class d-flex align-content-around flex-wrap. They align the contents of the div. Bootstrap doku: https://getbootstrap.com/docs/4.0/utilities/flex/#align-content
- Set width of div inside this container in widht of parent with w-100
Since <p> adds margin at the bottom, your blue div at the ends does not close with a black div. I added the “mb-0” class, which sets the lower bound of the “0” field so you can see that it works.
This should work if the right or left div is the one with the greater height property.
Edit: Added classes to align content.
source share