display: grid;
grid-template-columns:var(--side-bar-width) 1fr;
grid-template-rows: 60px 1fr 90px;
gap: 0px 0px;
grid-template-areas:
"Sidebar Header"
"Sidebar Body"
"Player Player";
I have three components, each render a div with a classname of
.Body { ... grid-area: Body; }
,
.Sidebar { ... grid-area: Sidebar; }
,
.Player{ ... grid-area: Player; }
respectively
The Player
component is a conditional render of height 90px, it is not visible initially so sometimes it looks like the viewport has 90px of empty space at the bottom of the screen at page load
The Player
component/content belongs to the Player
grid-area
. How do you hide the grid-area with empty content dynamically in the grid template? Hiding could mean min-height 0 or display none
In other words, i want to show/hide the last grid-template-row if Player component was rendered then adjust the grid to fill screen
I also saw CSS Grid. Hide unused area & Preventing fixed footer from overlapping content
update:
The Player css has these additional attributes
.Player {
...
height: 90px;
display: flex;
width: 100%;
position: fixed;
bottom: 0;
}