html - 3 divs horizontally, set last's height to auto -


i have 3 divs, each width:100%, placed under each other. here's how looks:

my code is:

<div class="welcome">    <h1>welcome</h1>    <small>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod    tempor incididunt ut labore et dolore magna aliqua.</small> </div> <div class="welcome2">    <h1>about</h1>    <small>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod    tempor incididunt ut labore et dolore magna aliqua.<small> </div> <div class="welcome3">    <h1>why choose us?</h1>    <div class="row">       <div class="col-md-4 why">          <i class="fa fa-reply-all fa-3x why-icon"></i>          <strong>fast support</strong>          <p>our moderators problem.</p>       </div>       <div class="col-md-4 why">          <i class="fa fa-reply-all fa-3x why-icon"></i>          <strong>fast support</strong>          <p>our moderators problem.</p>       </div>       <div class="col-md-4 why">          <i class="fa fa-reply-all fa-3x why-icon"></i>          <strong>fast support</strong>          <p>our moderators problem.</p>       </div>       <div class="col-md-4 why">          <i class="fa fa-reply-all fa-3x why-icon"></i>          <strong>fast support</strong>          <p>our moderators problem.</p>       </div>       <div class="col-md-4 why">          <i class="fa fa-reply-all fa-3x why-icon"></i>          <strong>fast support</strong>          <p>our moderators problem.</p>       </div>       <div class="col-md-4 why">          <i class="fa fa-reply-all fa-3x why-icon"></i>          <strong>fast support</strong>          <p>our moderators problem.</p>       </div>    </div> </div> 

css

.welcome {     text-align: center;     width: 100%;     background-color: #3ba666;     background-image: linear-gradient(60deg, #4dac71 50%, #3ba666 50%);     padding: 50px; }  .welcome2 {     text-align: center;     width: 100%;     background-color: #ff61e7;     background-image: linear-gradient(60deg, #ff61e7 50%, #ff61d0 50%);     padding: 50px; }  .welcome3 {     text-align: center;     width: 100%;     background-color: #32c8de;     background-image: linear-gradient(60deg, #32d0de 50%, #32c8de 50%);     padding: 50px; }  .why {     /** text-align: left; **/     padding: 15px; }  .why-icon {     color: #0e495c;     display: block; } 

i want - first 2 normal height, , last 1 fill empty white space. possible?

here fiddle: https://jsfiddle.net/21dydo07/1/

yes, css3. give design's parents (body, html, ...) height of 100%. set height .welcome , .welcome2, e.g. 200px each. after that, set .welcome3 take rest, this:

html, body {height: 100%} .welcome, .welcome2 {height: 200px} .welcome3 {height: calc(100% - 400px)} 

another solution set specific height every element (that css2 comapatible), wouldn't allow fill 100% of screen height , have third div variable height.

if need first solution, need css2 compliance (e.g. ie8), might need javascript fallback, set height .welcome3 accordingly @ pageload, (needs jquery):

$(document).ready(function() {     $(".welcome3").css("height",$(window).height()-400); }); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -