I have two images and two paragraphs next to each other, I have used the approach as shown in the code and it worked fine. The problem occurs when I set both images' height to 400px so that if the paragraph is taking more space than 400px, it should take the space around the images. It works fine in mobile view but not in desktop view. In the image below please consider div 2 and 4 as paragraph and div 1 and 3 as images.
I want it to look like this:
I want the paragraph to take 100% space if it is long and then the same with div 3 and 4. Here is my code:
<div class="col-11">
<div style="margin-left:10px;margin-right:10px;">
{% for news in news %}
<h1 class="text-center" style="color: black; margin-top:20px; font-size:50px;">{{news.title}}</h1>
<div class="row g-2">
<div class="col-12 col-md-6 order-2 order-md-1" style="color: #025; margin-top:20px; font-size:20px;">
{% if news.para_one %}
<p>{{news.para_one|safe}}</p>
{% endif %}
</div>
<div class="col-12 col-md-6 order-1 order-md-2">
{% if news.image %}
<img src="{{news.image.url}}" alt="" class="img" style="height: 400px; width:650px;">
{% endif %}
</div>
</div>
<div class="detail" style="color: #025; margin-top:20px; font-size:20px;">
{% if news.para_two %}
<p >{{news.para_two|safe}}</p>
{% endif %}
</div>
<div class="col-12">
{% if news.disclaimer %}
<p style="border:1px solid #025; border-top: 5px solid #025; font-size:20px; font-weight:700">Disclaimer :<span style="font-weight: 500;">{{news.disclaimer}}</span></p>
{% endif %}
</div>
<div style="margin-bottom: 20px;">
<p style="margin-left:10px; font-size :25px; font-weight:700;">Written By : <span style="color: #025;">{{news.written_by}}</span> </p>
<p style="margin-left:10px; font-size :25px; font-weight:700;">Date & Time: <span style="color: #025;">{{news.joined_date}}</span> </p>
</div>
{% endfor %}
CSS:
.col-11{
margin-left: auto;
margin-right: auto;
height: 100%;
background-color: #fff;
}
.row > .col-md-6:last-child:nth-child(odd) {
width: 100%;
}
@media screen and (max-width: 600px) {
.img{
height: 200px !important;
width: 100% !important;
}
}
I have tried this solution https://stackoverflow.com/a/68943035/14777930 but maybe it is not what I am looking for. Please do not mind these tags all the data is fetched from the database. Any help would be appreciated.