1

I've read through How to resize an image to fit in the browser window? but it doesn't really fit my need. All there is written for the image to fill the entire browser window. But I want a container of varying height above the image. And a fixed height section below.

JavaScript can get the height of the container. I found:

var offsetHeight = document.getElementById('topsection').offsetHeight;

Andrew Beals's solution on that page looks like a start, but how to subtract the container height, and say 2em for under? I know no JavaScript, so I'd much appreciate some help.

donwiss
  • 11
  • 3
  • I think I do not understand your question, could you put an example HTML? Do you need JS? Wouldn't CSS Grid Layoud? https://developer.mozilla.org/es/docs/Web/CSS/CSS_Grid_Layout – Antonio Torres Jun 22 '21 at 00:02
  • To understand what I am looking for, one has to first fully understand what is being done on that page. Then, where that page has the image covering the entire window, I want it to fill the space below a top section and above a footer. So the height calculation, instead of being the window height, has to be that height, less the height of the top section and footer. – donwiss Jun 24 '21 at 06:09

0 Answers0