html - images that squishes when I add more using flexbox -


i'm using amchart , want display multiple charts in 1 page (as columns), problem don't want scroll bar no matter how many charts add (yes want them squish) when display 1 chart want in it's normal size (not squished or small)

how can achieve that? i'm trying images , if works on charts.

html:

<div class="content">   <div class="row">      <div class="cell">       <img src="http://i.imgur.com/oula6mk.jpg"/>     </div>     <div class="cell">       <img src="http://i.imgur.com/m16wzmd.jpg"/>     </div>         <div class="cell">       <img src="http://i.imgur.com/m16wzmd.jpg"/>     </div>         <div class="cell">       <img src="http://i.imgur.com/m16wzmd.jpg"/>     </div>   </div>     </div> </div> 

css:

body{    overflow-y : hidden;} .content {     background-color: yellow;      }  .row {     display: -webkit-box;     display: -moz-box;     display: -ms-flexbox;     display: -webkit-flex;     display: flex;      -webkit-box-orient: vertical;      -moz-box-orient: vertical;     box-orient: vertical;     flex-direction: column;      -webkit-box-pack: center;     -moz-box-pack: center;     box-pack: center;     justify-content: center;      -webkit-box-align: center;     -moz-box-align: center;     box-align: center;       align-items: center;      background-color: red;  }  .cell {     -webkit-box-flex: 1;     -moz-box-flex: 1;     box-flex: 1;     -webkit-flex: 1 1 auto;     flex: 1 1 auto;       padding: 10px;     margin: 10px;      background-color: green;     border: 1px solid red;     text-align: center; } img {max-height:100%;} 

on jsfiddle: http://jsfiddle.net/89dtxt6s/356/

thanks!

step 1: add following .row ensure fills viewport height:

.row {   height: 100vh; } 

step 2: need give each .cell flex display. additionally, you'll need adjust flex-basis (third argument shorthand) 100%. finally, you'll need set min-height zero, in order each element totally shrink, if need be.

.cell {   display: flex;   flex-direction: column;   flex: 1 1 100%; /* no longer auto */   min-height: 0; } 

step 3: add one-hundred percent width , height image.

img {   width: 100%;   height: 100%; } 

result: squishy images. ugly? sure. i'm not judging.

enter image description here

https://jsfiddle.net/jaunkv7k/


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -