Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 38093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:39:13+00:00 2026-05-10T14:39:13+00:00

In a web application, I have a page that contains a DIV that has

  • 0

In a web application, I have a page that contains a DIV that has an auto-width depending on the width of the browser window.

I need an auto-height for the object. The DIV starts about 300px from the top screen, and its height should make it stretch to the bottom of the browser screen. I have a max height for the container DIV, so there would have to be minimum-height for the div. I believe I can just restrict that in CSS, and use Javascript to handle the resizing of the DIV.

My javascript isn’t nearly as good as it should be. Is there an easy script I could write that would do this for me?

Edit: The DIV houses a control that does it’s own overflow handling (implements its own scroll bar).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:39:13+00:00Added an answer on May 10, 2026 at 2:39 pm

    Try this simple, specific function:

    function resizeElementHeight(element) {   var height = 0;   var body = window.document.body;   if (window.innerHeight) {       height = window.innerHeight;   } else if (body.parentElement.clientHeight) {       height = body.parentElement.clientHeight;   } else if (body && body.clientHeight) {       height = body.clientHeight;   }   element.style.height = ((height - element.offsetTop) + 'px'); } 

    It does not depend on the current distance from the top of the body being specified (in case your 300px changes).


    EDIT: By the way, you would want to call this on that div every time the user changed the browser’s size, so you would need to wire up the event handler for that, of course.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 240k
  • Answers 240k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer <%= Html.ActionLink("Task", "Edit", new { id = "2" }) %>… May 13, 2026 at 7:08 am
  • Editorial Team
    Editorial Team added an answer By using the Date object and its milliseconds value, differences… May 13, 2026 at 7:08 am
  • Editorial Team
    Editorial Team added an answer Did you implement DIGEST-MD5 yourself, or are you using a… May 13, 2026 at 7:08 am

Related Questions

We have a web application that is based around a form that gets passed
I have a Windows application which has a browser in it. The Windows application
I have a custom URL protocol for an application I'm working on (as defined
I am currently working on an advanced web application that contains a number of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.