When utilizing Bootstrap, it is recommended to include .container(your parent class)
before making any modifications to the style of Bootstrap classes.
Use .container .row(Bootstrap class)
instead of affecting all Bootstrap row classes in your project
For an alternative solution:
.container .col-lg-6
You can remove the h-100
and implement:
.orange {
background-color: orange;
height: 100%;
}
.container .row{
overflow: hidden;
}
img {
display: block;
max-width: 100%;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
min-height: 100vh;
overflow: hidden;
display: grid;
place-content: center;
margin: 0;
background-color: bisque;
}
.orange {
background-color: orange;
height: 100%;
}
.container .row {
overflow: hidden;
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="690b06061d1a1d1b0819295c4759475b">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col-lg-6">
<h2>Heading one</h2>
<img src="https://dummyimage.com/600x400/000/fff" alt="testing">
</div>
<div class="col-lg-6">
<h2>Heading Two</h2>
<div class="orange ">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
</div>
Another approach would be to use:
.container .col-lg-6{
display: flex;
flex-direction: column;
}
.orange {
background-color: orange;
flex-basis: 100%;
}
img {
display: block;
max-width: 100%;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
min-height: 100vh;
overflow: hidden;
display: grid;
place-content: center;
margin: 0;
background-color: bisque;
}
.container .col-lg-6 {
display: flex;
flex-direction: column;
}
.orange {
background-color: orange;
flex-basis: 100%;
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b2d0ddddc6c1c6c0d3c2f2879c829c80">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />
<div class="container">
<div class="row">
<div class="col-lg-6">
<h2>Heading one</h2>
<img src="https://dummyimage.com/600x400/000/fff" alt="testing" />
</div>
<div class="col-lg-6">
<h2>Heading Two</h2>
<div class="orange">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</div>
</div>
</div>
Alternatively, you can follow a similar approach as the first one but without using overflow:hidden;
img{
display: block;
max-width: 100%;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
body{
min-height: 100vh;
overflow: hidden;
display: grid;
place-content: center;
margin:0;
background-color: bisque;
}
.container .col-lg-6{
display: flex;
flex-direction: column;
}
.orange {
background-color: orange;
height: 100%;
}
<link
href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4c2e2323383f383e2d3c0c79627c627e">[email protected]</a>/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous"
/>
<div class="container">
<div class="row">
<div class="col-lg-6">
<h2>Heading one</h2>
<img src="https://dummyimage.com/600x400/000/fff" alt="testing" />
</div>
<div class="col-lg-6">
<h2>Heading Two</h2>
<div class="orange">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</div>
</div>
</div>