We help IT Professionals succeed at work.
Get Started

how to make a div take the remaining space in a container

chand pb
chand pb asked
on
615 Views
Last Modified: 2016-02-25
Hello,
  How do I make a div element take the height of the remaining space?.  I have  a container with a nav header and  footer (both are fix). I want to put 2 div element  in between the header and footer. The first div is 200px and the second div should take over the remain space.


Here is a picture
Capture.PNG
I would like the grey area to span the remaining space. ?

Here is my code
Link to plunk: http://plnkr.co/edit/xb1HLIhSfVZzEe2p7bT0?p=preview

<!DOCTYPE html>
<html>

<head>
  <link data-require="bootstrap@3.3.2" data-semver="3.3.2" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
  <script data-require="bootstrap@3.3.2" data-semver="3.3.2" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
  <script data-require="jquery@2.1.3" data-semver="2.1.3" src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
  <link rel="stylesheet" href="style1.css" />
  <style>
    .rfooter {
      height: 4em;
      text-align: center;
      color: white;
      background-color: green;
      font-size: 1.5em;
    }
    .footerSeachButton {
      background: #2175d9;
      color: white;
      text-align: center;
      height: 4em;
      vertical-align: middle;
      line-height: 4em;
    }
    .footerSeachButton span {
      display: block;
      height: 20px;
    }
    span.footericon {
      line-height: 3;
    }
    .footerLoginButton {
      background: #00308f;
      color: white;
      text-align: center;
      height: 4em;
      vertical-align: middle;
      line-height: 4em;
    }
    .footerLoginButton span {
      display: block;
      height: 15px;
    }
    .searchResulNavBar {
      background-color: #2175d9;
      padding-left: 2em;
      padding-right: 2em;
      height: 3em;
      line-height: 3em;
      color: white;
      text-align: center;
      font-size: medium;
    }
    .success {
      background: yellow;
      height: 200px;
    }
    .info {
      background-color: grey;
    }
  </style>

</head>

<body>
  <div class="container">
    <div class="row">
      <nav class="navbar navbar-fixed-top">
        <div class="row searchResulNavBar ">
          <span class="glyphicon glyphicon-chevron-left pull-left navglyphicon" aria-hidden="true"></span>
          <div class="text-center "><strong>Confirmation</strong>
          </div>
        </div>
      </nav>
    </div>
    <div class="row" style="padding-top:3.5em">
      <article>
        <section class="success ">
          need the entire section to be yellow [to section 2-grey]
        </section>
        <section class="info">
          need the entire section to be grey [to the start of the footer]
        </section>
      </article>
    </div>
    <footer class=" row navbar-fixed-bottom rfooter">
      <div class="container">
        <div class="row">
          <div class="col-xs-6 col-md-6 footerSeachButton">

            <span class="glyphicon glyphicon-search footericon" aria-hidden="true"></span>
            <span class="">Search</span>
          </div>
          <div class="col-xs-6 col-md-6 footerLoginButton ">
            <span class="glyphicon glyphicon-user footericon" aria-hidden="true"></span>
            <span class="">Login - Register</span>
          </div>
        </div>
      </div>
    </footer>
  </div>
</body>

</html>

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 3 Answers and 5 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE