Dynamically resize div based on user monitor size / resolution

I have a design with three rows, one column, and I would like the div size for the center content to remain equal to the rest of the column (screen height - (hardcoded footerheight + hardcoded header height)). Is there a good way to do this using CSS? If not, how can I accomplish this with javascript?

Thank,

Tom

#container {
  background-color: gray;
  height: 100%;
}
#centercolumn {
  background-color: white;
  margin-left: auto;
  margin-right: auto;
  width: 800px;
  height: 100%;
}
#header {
  background-color: blue;
  height: 150px;
}
#content {
  background-color: yellow;
}
#footer {
  height: 50px;
  background-color: blue;
}

<html>
  <head>
    <link rel="stylesheet" href="test.css" type="text/css" media="screen"/>
  </head>
  <body>
    <div id="container">
      <div id="centercolumn">
        <div id="header">
          header
        </div>
        <div id="content">
          content
        </div>
        <div id="footer">
          footer
        </div>
      </div>
    </div>
  </body>
</html>
+2
source share
1 answer

Sticky Footer will set you free.

+3
source

Source: https://habr.com/ru/post/1751296/


All Articles