I am trying to accomplish what seems like a very simple task with flexbox, but after a few hours I fail ...
I just want to create a horizontal component responsive with the image on the left , which will always be the 100%height and slightly flexible width of the text on the right .
It should be easy, but the image never stops overlapping at best ...
body {
font-family: sans-serif;
}
.card {
background: #F1F1F2;
display: flex;
}
.card-img {
border: 1px solid green;
}
img {
display: block;
height: 100%;
width: auto;
}
.card-body {
flex: 1 1 auto;
display: flex;
flex-direction: column;
justify-content: space-between;
border: 1px solid blue;
}
<div class="card">
<div class="card-img">
<img src="http://placehold.it/100x100" alt="Card image">
</div>
<div class="card-body">
<h4 class="card-title">Card title</h4>
<p class="card-text">Some amazing content lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
Run codeHide result
source
share