html - Fullscreen and auto-height on second element -


i'm trying implement image box in html5/css3 showing image , description underneath in fullscreen lightbox. problem have description @ bottom of screen have dynamic height (i.e. don't want description cut) , image take remaining space, constrained max-width , max-height of 100% of remaining space.

my problem bit similar "dynamic-height sticky-footer" problem, except whole content should have 100% height, no more, no less.

i've tried solve problem "table-row technique" because of dynamic height: see http://galengidman.com/2014/03/25/responsive-flexible-height-sticky-footers-in-css/ explanation. can't make work. either large image makes table grow out of bounds or can't force description "take" height before image. see fiddle here: https://jsfiddle.net/sprat/ho463toa/

.content {   display: table;   width: 100%;   table-layout: fixed; /* not work with, not work without either */ }  .image-area {   display: table-row;   height: 1px; }  .description-area {   display: table-row;   height: auto; } 

so need help. i'm looking pure css solution if it's possible. maybe that's can done flexbox i'm little bit concerned browser support. ideas?

i suggest use flexbox layout. prefixes supports ie10+.

it uses background image instead of inline image.

jsfiddle example

html, body { height: 100%; }  body { margin: 0; }  img {    max-width: 100%;    max-height: 100%;  }  p {    margin: 0;  }  .fullscreen {    position: fixed;    left: 20px; right: 20px; top: 20px; bottom: 20px;  }  .content {    display: flex;    flex-direction: column;    width: 100%;    height: 100%;  }  .image-area {    flex: 1;    position: relative;  }  .image-area:after {    content: "";    display: block;    background: url('//dummyimage.com/1000') center / cover;    position: absolute;    left: 0; right: 0; top: 0; bottom: 0;  }  .description-area {    background: lightblue;  }
<div class="fullscreen">    <div class="content">      <div class="image-area">        <!-- <img src="http://img0.mxstatic.com/wallpapers/f424924e12f269c3dfd65e5be8cda9ba_large.jpeg"> -->      </div>      <div class="description-area">        <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. donec congue et ante id sodales. etiam mollis neque nisi, id maximus tellus condimentum a. duis condimentum erat quis ligula maximus mollis. morbi congue, nunc sit amet suscipit consectetur,          enim tortor lobortis felis, eget aliquam sem tortor quis augue. duis ac viverra urna, non scelerisque leo. nam vel dolor risus. duis feugiat vulputate neque id fermentum. aenean rhoncus libero ipsum, commodo vulputate dui commodo a. maecenas sit          amet pulvinar orci. proin dapibus dui vel justo vulputate, aliquam dui rhoncus. phasellus lacinia venenatis leo, vel facilisis lorem. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. integer erat ipsum, pharetra          ac tempor et, viverra et nibh.</p>      </div>    </div>  </div>


useful links:


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -