Flexbox image height resize - css

I'm having trouble getting my images to resize fully.
Ideally I want the image to resize so that the option fits the screen, currently it only fits the width, why so? Is it possible to get the behavior I wish by just using css, maybe a media query is needed? Scorched over google trying to find a similar problem, but no luck!
Thanks in advance!
UPDATE:
To clarify, my problem is that the image is not resized, if the height of the window gets small enough - the header disappears and I get a scroll bar. I want all of the content to scale down, so that no scroll bar is needed.
.container {
min-height: 100vh;
display: flex;
flex-direction: column;
background-color: aqua;
}
.content {
display: flex;
overflow-x: auto;
flex: 2 1 auto;
flex-wrap: nowrap;
}
.content::-webkit-scrollbar {
display: none;
}
.option {
display: flex;
flex-direction: column;
margin: auto 1em;
width: 90%;
height: 70%;
text-align: justify;
border: 3px solid black;
}
.img {
flex: 1;
}
.title {
flex: 0;
font-weight: bold;
text-align: center;
flex: 1;
margin: auto;
}
.desc {
flex: 0;
}
.header {
flex: 2;
text-align: center;
background-color: red;
}
.footer {
flex: 1;
background-color: brown;
}
<div class="container">
<div class="header">
Fusce pellentesque ante.
</div>
<div class="content">
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Proin hendrerit.</p>
<p class="desc">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur fringilla non lacus tincidunt suscipit. Nam nec arcu a erat convallis.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Nullam at.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut congue eros. Aenean sit amet quam efficitur, lacinia ligula ac.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Sed nec.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam porttitor nisi mauris, ac interdum tellus pulvinar id. Morbi non molestie</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Morbi in.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam non rutrum arcu, ac posuere odio. Nunc in dolor eget nisi.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Mauris ac.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pulvinar orci non consectetur accumsan. Aenean posuere, felis commodo congue pulvinar.</p>
</div>
</div>
<div class="footer">
<p>Quisque venenatis volutpat dictum. Praesent.</p>
</div>
</div>
Fiddle

Hope this is what you want. If this is the right answer! Here is what i did.
give the container class of height and width a 100% and set display to flex and flex-direction: column so header, footer and content class get aligned vertically.
Now, if you set content class flex prorperty to 1 it will take rest of width and height.
give option class a property of display: flex and set flex-direction: column so image and the title and description get aligned vertically.
by assign min-height of 30px to the title and p in the options, rest of the space can be assigned to image, which I hope is what you want.
* {
margin: 0;
padding: 0;
}
.content {
min-height: 100%;
width: 100%;
min-width: 100%;
display: flex;
flex-direction: row;
box-sizing: border-box;
padding: 30px 0;
}
.content .option {
flex: 1;
max-height: 100vh;
min-width: 100%;
display: flex;
flex-direction: column;
}
.content .option img {
height: calc(100% - 160px);
width: 100%;
}
.content .option p {
height: 20px;
}
.content .option p:nth-child(2) {
height: 40px;
}
.header,
.footer {
position: fixed;
left: 0;
right: 0;
background-color: #ccc;
height: 30px;
}
.header {
top: 0;
}
.footer {
bottom: 0;
}
<div class="container">
<div class="header">
Fusce pellentesque ante.
</div>
<div class="content">
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Proin hendrerit.</p>
<p class="desc">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur fringilla non lacus tincidunt suscipit. Nam nec arcu a erat convallis.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Nullam at.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut congue eros. Aenean sit amet quam efficitur, lacinia ligula ac.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Sed nec.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam porttitor nisi mauris, ac interdum tellus pulvinar id. Morbi non molestie</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Morbi in.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam non rutrum arcu, ac posuere odio. Nunc in dolor eget nisi.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Mauris ac.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pulvinar orci non consectetur accumsan. Aenean posuere, felis commodo congue pulvinar.</p>
</div>
</div>
<div class="footer">
<p>Quisque venenatis volutpat dictum. Praesent.</p>
</div>
</div>

html,
body {
padding: 0;
margin: 0;
}
.container {
height: 100vh;
display: flex;
flex-direction: column;
background-color: aqua;
justify-content: space-between;
}
.header,
.footer {
flex: 0 1 auto;
text-align: center;
}
.content {
display: flex;
overflow-x: auto;
flex-wrap: nowrap;
flex: 1 1 auto;
}
.footer {
background-color: brown;
}
img {
max-width: 600px;
}
<div class="container">
<div class="header">
Fusce pellentesque ante.
</div>
<div class="content">
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Proin hendrerit.</p>
<p class="desc">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur fringilla non lacus tincidunt suscipit. Nam nec arcu a erat convallis.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Nullam at.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut congue eros. Aenean sit amet quam efficitur, lacinia ligula ac.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Sed nec.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam porttitor nisi mauris, ac interdum tellus pulvinar id. Morbi non molestie</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Morbi in.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam non rutrum arcu, ac posuere odio. Nunc in dolor eget nisi.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Mauris ac.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pulvinar orci non consectetur accumsan. Aenean posuere, felis commodo congue pulvinar.</p>
</div>
</div>
<div class="footer">
<p>Quisque venenatis volutpat dictum. Praesent.</p>
</div>
</div>

Related

Horizontally Align content under title with multiple lines

My titles may be one line or multiple lines.
I'm trying to align the content under the title to the top without have to specify a height for the title.
If I use margin-bottom on the title, the content aligns to the bottom.
Adding min-height to the title gets the result I need but if the title breaks to more lines, the min-height breaks it.
In the image below, I am trying to get the text to align to the top of the red line.
.flexbox-row {
display: flex;
}
.columns .section-title {
margin-bottom: auto; /* ADDED */
}
.columns .item {
display: flex;
flex-direction: column;
max-width: 33.333333%;
flex-basis: 33.333333%;
padding: 0px 45px;
}
.columns .item:first-child {
padding-left: 0;
}
.columns .item:last-child {
padding-right: 0;
}
#buy-sell .columns p {
padding-right: 110px;
}
<section id="" class="columns">
<div class="outer-container">
<div class="flexbox-row item-wrapper">
<div class="item">
<h2 class="section-title">
Title 1
</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh.
</p>
</div>
<div class="item">
<h2 class="section-title">
Title 2 Title 2 Title 2 Title 2
</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh.
</p>
</div>
<div class="item">
<h2 class="section-title">
Title 3 Title 3 Title 3 Title 3 Title 3
</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh.
</p>
</div>
</div>
</div>
</section>
Try putting you titles in a different row than your content. For example:
<div class="row">
<h1>title</h1>
<h1>title</h1>
<h1>title</h1>
</div>
<div class="row">
<p>content</p>
<p>content</p>
<p>content</p>
</div>
This way the content will stick to the top of each row. You'll need to use some flex stuff to make it work the way you want it though. Something like this should work:
.row {
flex-direction: 'row';
justify-content: space-between;
min-height: '40px';
}
Without changing anything of the original code all you need to do is force the margin-bottom to a size you need. Fortunately a simple margin-bottom: auto will do the trick:
.columns .section-title {
margin-bottom: auto;
}
The snippet...
.flexbox-row {
display: flex;
}
.columns .section-title {
margin-bottom: auto; /* ADDED */
}
.columns .item {
display: flex;
flex-direction: column;
max-width: 33.333333%;
flex-basis: 33.333333%;
padding: 0px 45px;
}
.columns .item:first-child {
padding-left: 0;
}
.columns .item:last-child {
padding-right: 0;
}
#buy-sell .columns p {
padding-right: 110px;
}
<section id="" class="columns">
<div class="outer-container">
<div class="flexbox-row item-wrapper">
<div class="item">
<h2 class="section-title">
Title 1
</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh.
</p>
</div>
<div class="item">
<h2 class="section-title">
Title 2 Title 2 Title 2 Title 2
</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh.
</p>
</div>
<div class="item">
<h2 class="section-title">
Title 3 Title 3 Title 3 Title 3 Title 3
</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis elit nec magna placerat pharetra non vitae nibh.
</p>
</div>
</div>
</div>
</section>

"grid-template-columns: fit-content(50%) 1fr;" doesn't work as expected

My application has an element that contains two range items (title and description). I would like the title width to be larger compared to the description width, but if the title is too large, limit it so that the description also appears.
My solution (full code here)
.info {
display: grid;
grid-template-columns: fit-content(50%) 1fr;
overflow: hidden;
margin-bottom: 20px
}
but this solution have a problem with the case where the title is long and the description is too short.
It works differently in my application. (code here)
If there is no description, the title width is still 50%.
How to implement this, maybe there is an easier way?
.container {
max-width: 500px;
margin: 0 auto;
}
.info {
display: flex;
align-items: left;
text-align: left;
}
.title {
overflow: hidden;
font-size: 16px;
font-weight: 700;
white-space: nowrap;
text-overflow: ellipsis;
max-width: 50%;
margin: 0 5px 0 0;
}
.description {
color: #67697c;
overflow: hidden;
font-size: 16px;
white-space: nowrap;
text-overflow: ellipsis;
}
<div class="container">
<section class="info">
<div class="title">
short title
</div>
<div class="description">
shor description
</div>
</section>
<section class="info">
<div class="title">
short title
</div>
<div class="description">
long description - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec quam nulla. In eu dui faucibus, euismod urna eu, consequat elit.
</div>
</section>
<section class="info">
<div class="title">
long title - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec quam nulla. In eu dui faucibus, euismod urna eu, consequat elit.
</div>
<div class="description">
short description
</div>
</section>
<section class="info">
<div class="title">
long title - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec quam nulla. In eu dui faucibus, euismod urna eu, consequat elit.
</div>
<div class="description">
long description - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec quam nulla. In eu dui faucibus, euismod urna eu, consequat elit.
</div>
</section>
<div class="title">
long title without description - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec quam nulla. In eu dui faucibus, euismod urna eu, consequat elit.
</div>
</section>
</div>
I have added flex in the parent div and I gave 50% max-width for title.

How to make responsive three columns in a row with image text and link using Bootstrap 4?

I am struggling with the setting three responsive columns in a row using Bootstrap 4.
.buttons {
border: 1px solid #e86225;
color: #e86225 !important;
padding: 10px 20px;
font-size: 14px;
}
.buttons:hover {
border: 1px solid #ffffff;
background-color: #e86225;
color: #ffffff !important;
transition: background-color 1s, border 1s, color 1s;
}
.container-custom {
padding-top: 80px;
padding-bottom: 80px;
}
.custom-link {
padding: 15px 0;
}
.container p {
margin: 25px 0;
max-width: 400px;
}
#media(max-width: 767px){
.container-custom {
padding-top: 50px;
padding-bottom: 50px;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<div class="container">
<div class="row container-custom justify-content-center">
<h2>Blog</h2>
<div class='d-flex flex-wrap pt-5'>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSHBMzMRL0g3ELio_DdCRvdajdF812AQPP2AbmM_jYr_66CnwgS" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQh3Afn3A1FKb24tpO6eAdqr8hCdnafjqwCNqgjdSAWK1igoWfk" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQFsb6TxovKdTNx-8gdo1R01nZXxRRauett2KQ_ci76VgjK2hR7" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
</div>
</div>
The problem is when media screen width is smaller than 767px, they are going to the left. I want to make image in the middle of column, the beginning of the text should be at the beginning of the imaeg and the end of text at the end of image, button should be at the beginning of the image too like here:
enter image description here
Just add width:100% to your images so they take all the space on the column
.buttons {
border: 1px solid #e86225;
color: #e86225 !important;
padding: 10px 20px;
font-size: 14px;
}
.buttons:hover {
border: 1px solid #ffffff;
background-color: #e86225;
color: #ffffff !important;
transition: background-color 1s, border 1s, color 1s;
}
.container-custom {
padding-top: 80px;
padding-bottom: 80px;
}
.custom-link {
padding: 15px 0;
}
.container p {
margin: 25px 0;
max-width: 400px;
}
img{
width:100%;
}
#media(max-width: 767px){
.container-custom {
padding-top: 50px;
padding-bottom: 50px;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<div class="container">
<div class="row container-custom justify-content-center">
<h2>Blog</h2>
<div class='d-flex flex-wrap pt-5'>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSHBMzMRL0g3ELio_DdCRvdajdF812AQPP2AbmM_jYr_66CnwgS" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQh3Afn3A1FKb24tpO6eAdqr8hCdnafjqwCNqgjdSAWK1igoWfk" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQFsb6TxovKdTNx-8gdo1R01nZXxRRauett2KQ_ci76VgjK2hR7" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
</div>
</div>
The image width could be the issue. Add img { width: 100%; } and class="img-fluid" to your img tags.
Add to css:
img { width: 100%; }
HTML:
<img class="img-fluid" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQh3Afn3A1FKb24tpO6eAdqr8hCdnafjqwCNqgjdSAWK1igoWfk" alt="">
or something similar so the images look like the layout in your attached image.
Example codepen using your code: https://codepen.io/brooksrelyt/pen/MZdLYj

Bootstrap 3 thumbnail sticky bottom footer

I searched around but have nothing found about sticky bootstrap thumbnail footer. So is there someone who can help me solve this problem i want the footer to stick at the bottom of the thumbnail not after the paragraph.
HTML
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><b>Related Links</b></h3>
</div>
<div class="panel-body">
<ul class="equal-height-thumbnail">
<li>
<figure><img src="http://www.htmllion.com/img/thumb.jpg" alt="Equal height of thumbnail"></figure>
<div class="caption">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget enim et augue mattis tempor nec eget felis. </p>
</div>
<div class="panel-footer">
<p>Read</p>
<p><span class="glyphicon glyphicon-time"> 13:27</span></p>
</div>
</li>
<li>
<figure><img src="http://www.htmllion.com/img/thumb.jpg" alt="Equal height of thumbnail"></figure>
<div class="caption">
<p>Lorem ipsum dolor sit amet, consectetur adi amet, consectetur adi amet, consectetur adi amet, consectetur adi amet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesque eget enim et augue mattis tempor nec eget felis. </p>
</div>
<div class="panel-footer">
<p>Read</p>
<p><span class="glyphicon glyphicon-time"> 13:27</span></p>
</div>
</li>
<li>
<figure><img src="http://www.htmllion.com/img/thumb.jpg" alt="Equal height of thumbnail"></figure>
<div class="caption">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesque eget enim et augue mattis tempor nec eget felis. </p>
</div>
<div class="panel-footer">
<p>Read</p>
<p><span class="glyphicon glyphicon-time"> 13:27</span></p>
</div>
</li>
</ul>
</div>
</div>
CSS
.equal-height-thumbnail {
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin: 0;
padding: 0;
list-style: none;
}
.equal-height-thumbnail li {
width: 30%;
margin: 0 1% 20px;
padding:0 0.5%;
background: #FFF;
box-shadow: 0 0 1px 1px rgba(0,0,0,0.1)
}
.equal-height-thumbnail figure {
display: block;
margin: 5px 0;
padding: 0;
}
.equal-height-thumbnail figure img{ width:100%;}
.caption { padding: 2%;}
.equal-height-thumbnail panel-footer {
padding:0px;
}
JSFIDDLE

Flexbox items in flexbox item expanding parent

I am having a problem while trying to use Flexbox for some markup.
I have made this codepen to demonstrate my problem: http://codepen.io/anon/pen/QjbzJY?editors=110
I want the image in the left(.item1 - The multicolor image) to dictate the width of the right box (.item2 - That contains alle the .itemitem$).
But as it is now the right box gets wider and presses the left one.
Hope one of you can help me get to a solution! :)
The Code:
<div class="parent">
<div class="item1">
<img src="http://www.joomlaworks.net/images/demos/galleries/abstract/7.jpg" alt="" />
</div>
<div class="item2">
<div class="itemitem1 item">
<div class="innerimg"><img src="http://hartcornstudios.com/wp-content/uploads/2014/01/1280x900textPlaceholder-Image.gif" alt="" /></div>
<div class="innertext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque non lorem ante. Curabitur fermentum ligula vel quam fermentum, eget suscipit mauris dictum.</div>
</div>
<div class="itemitem2 item">
<div class="innerimg"><img src="http://hartcornstudios.com/wp-content/uploads/2014/01/1280x900textPlaceholder-Image.gif" alt="" /></div>
<div class="innertext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque non lorem ante. Curabitur fermentum ligula vel quam fermentum, eget suscipit mauris dictum.</div>
</div>
<div class="itemitem3 item">
<div class="innerimg"><img src="http://hartcornstudios.com/wp-content/uploads/2014/01/1280x900textPlaceholder-Image.gif" alt="" /></div>
<div class="innertext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque non lorem ante. Curabitur fermentum ligula vel quam fermentum, eget suscipit mauris dictum.</div>
</div>
<div class="itemitem4 item">
<div class="innerimg"><img src="http://hartcornstudios.com/wp-content/uploads/2014/01/1280x900textPlaceholder-Image.gif" alt="" /></div>
<div class="innertext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque non lorem ante. Curabitur fermentum ligula vel quam fermentum, eget suscipit mauris dictum.</div>
</div>
<div class="itemitem5 item">
<div class="innerimg"><img src="http://hartcornstudios.com/wp-content/uploads/2014/01/1280x900textPlaceholder-Image.gif" alt="" /></div>
<div class="innertext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque non lorem ante. Curabitur fermentum ligula vel quam fermentum, eget suscipit mauris dictum.</div>
</div>
<div class="itemitem6 item">
<div class="innerimg"><img src="http://hartcornstudios.com/wp-content/uploads/2014/01/1280x900textPlaceholder-Image.gif" alt="" /></div>
<div class="innertext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque non lorem ante. Curabitur fermentum ligula vel quam fermentum, eget suscipit mauris dictum.</div>
</div>
<div class="itemitem7 item">
<div class="innerimg"><img src="http://hartcornstudios.com/wp-content/uploads/2014/01/1280x900textPlaceholder-Image.gif" alt="" /></div>
<div class="innertext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque non lorem ante. Curabitur fermentum ligula vel quam fermentum, eget suscipit mauris dictum.</div>
</div>
<div class="itemitem8 item">
<div class="innerimg"><img src="http://hartcornstudios.com/wp-content/uploads/2014/01/1280x900textPlaceholder-Image.gif" alt="" /></div>
<div class="innertext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque non lorem ante. Curabitur fermentum ligula vel quam fermentum, eget suscipit mauris dictum.</div>
</div>
<div class="itemitem9 item">
<div class="innerimg"><img src="http://hartcornstudios.com/wp-content/uploads/2014/01/1280x900textPlaceholder-Image.gif" alt="" /></div>
<div class="innertext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque non lorem ante. Curabitur fermentum ligula vel quam fermentum, eget suscipit mauris dictum.</div>
</div>
</div>
</div>
CSS:
* {
border: 0;
padding: 0;
margin: 0;
cursor: pointer;
}
body {
background: black;
}
img {
max-wifth: 100%;
max-height: 100%;
}
.parent {
width: 930px;
height: 180px;
display: -webkit-flex;
align-items: stretch;
background-color: gray;
}
.item1 {
display: -webkit-flex;
align-items: center;
-webkit-justify-content: space-around;
-webkit-flex-grow: 0;
box-sizing: border-box;
overflow: hidden;
}
.item2 {
display: -webkit-flex;
-webkit-align-items: center;
-webkit-flex-grow: 0;
box-sizing: border-box;
overflow: hidden;
-webkit-flex-wrap: wrap;
-webkit-justify-content: space-around;
-webkit-align-content: space-between;
max-width: 100%;
background: red;
height: 100%;
}
.item {
width: 49%;
height: 100%;
background-color: #fff;
margin-bottom: 5px;
box-sizing: border-box;
display: -webkit-flex;
background: green;
}
.innerimg {
width: 50%;
height: 100%;
}
.innertext {
width: 50%;
height: 100%;
}
.innerimg img {
max-width: 100%;
max-height: 100%;
}
It seems like flex-shrink: 0; on the box i don't want to shrink does the trick!

Resources