I'm developing a web page and in it I have a list of news, divs with 2 other divs inside, an image on the left, and the title, date and the first 30 words of the news on the right. I want the image div to take the height of the text div, no matter what the size of the image is. The images usually don't have the same size/aspect ratio. I prefer to avoid fixed dimensions, since I want it to be responsive. By the way I'm using Bootstrap 3.3.7.
Here an example of what I have so far.
This is my HTML
<!-- First News -->
<div class="container-fluid panel panel-default">
<div class="col-xs-12 col-sm-4 news-img-div">
<img src="https://fakeimg.pl/412x112/" alt="img_1" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-8 news-text-div">
<h4>News Title 1</h4>
<p>Nov 6, 2017</p>
<p class="text-justify">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eu vehicula turpis. Donec tristique consequat libero a dapibus. Quisque in dolor tellus. Suspendisse auctor in libero non porta. Aliquam eu.</p>
<a href="" class="btn btn-primary" role="button">See More</a>
</div>
</div>
<!-- Second News -->
<div class="container-fluid panel panel-default">
<div class="col-xs-12 col-sm-4 news-img-div">
<img src="https://fakeimg.pl/350x232/" alt="img_2" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-8 news-text-div">
<h4>News Title 2</h4>
<p>Nov 5, 2017</p>
<p class="text-justify">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eu vehicula turpis. Donec tristique consequat libero a dapibus. Quisque in dolor tellus. Suspendisse auctor in libero non porta. Aliquam eu.</p>
<a href="" class="btn btn-primary" role="button">See More</a>
</div>
</div>
<!-- Third News -->
<div class="container-fluid panel panel-default">
<div class="col-xs-12 col-sm-4 news-img-div">
<img src="https://fakeimg.pl/243x242/" alt="img_curso" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-8 news-text-div">
<h4>News Title 3</h4>
<p>Nov 4, 2017</p>
<p class="text-justify">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eu vehicula turpis. Donec tristique consequat libero a dapibus. Quisque in dolor tellus. Suspendisse auctor in libero non porta. Aliquam eu.</p>
<a href="" class="btn btn-primary" role="button">See More</a>
</div>
</div>
And this is my CSS (for visualization purposes)
.news-img-div {
background-color: red;
}
.news-text-div {
background-color:aqua;
}
I set a background color to the divs for better visualization. You might need to expand the result tab so the image and the text stay in the same row.
Is there a way to accomplish using only CSS? Otherwise I welcome solutions with js.