0

I know this is an already asked question, but no solution found work on my pages.

I have a page:

  1. header with fixed height: 60px
  2. sub-header div: height dinamic based on content
  3. search div: height dinamic based on content
  4. fullcalendar div: this div need to be equal to remaining space available to fit screen

      <header style="height:60px">LOGO + HORIZONTAL MENU</header>
      <div id="sub-header">SOME CONTENT HERE...</div>
      <div id="search-div">SOME CONTENT HERE FOR SEARCH...</div>
      <div id="fc-div"><div id="calendar"></div></div>
    

I want to set fc-div to get height of remaining space to prevent scroll-y

Giuseppe Lodi Rizzini
  • 1,045
  • 11
  • 33

1 Answers1

0

If you set the body (or any parent div) to have a height of 100vh, then make it a flex component with direction: column, and give the fc-div a flex-grow of 1, I think it should work. So:

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#fc-div {
  flex-grow: 1;
}


/* for demo */
body {
  margin:0;
}

#fc-div {
  background:gray;/* see me */
}
<header style="height:60px">LOGO + HORIZONTAL MENU</header>
<div id="sub-header">SOME CONTENT HERE...</div>
<div id="search-div">SOME CONTENT HERE FOR SEARCH...</div>
<div id="fc-div">
  <div id="calendar"></div>
</div>

EDIT: Was missing the '#' before fc-div

G-Cyrillus
  • 101,410
  • 14
  • 105
  • 129