I have the following top level css grid
. It has 2 rows and 2 columns. In 1st row, I have put a <p>
which occupies the entire row. In 2nd row, I have placed 2 components, 1 in each column
.homepage-component-css-grid-container{
display: grid;
grid-gap:20px;
grid-template-rows: 50px 1fr;
grid-template-columns: 1fr 1fr;
height:100%;
}
p { /*1 row, 2 columns*/
font: 300 1.5em 'Raleway', sans-serif;
color: rgba(0,0,0,.5);
grid-row: 1/2;
grid-column: 1/-1;
}
app-practice-component{ /*2nd row, 1st column*/
grid-row: 2/3;
grid-column: 1 / 2;
align-self: center;
justify-self:end;
}
app-create-component{/*2nd row, 2nd column*/
grid-row: 2/3;
grid-column: 2 / 3;
align-self: center;
justify-self:start;
}
app-create-component
and app-practice-components
are themselves css grids of 4 rows, 1 column. I am placing 1 <p>
each in the 1st 3 rows and 1 <button>
in the 4th row
.css-grid-container__create-div{
display:grid;
grid-template-rows:1fr 1fr 1fr 1fr;
grid-template-columns: 1fr;
}
.css-grid-item__create-para1-div{
margin-left:40px;
margin-top:30px;
grid-column: 1 / -1;
grid-row: 1 / 2;
}
.css-grid-item__create-para2-div{
margin-left:40px;
margin-top:30px;
grid-column: 1 / -1;
grid-row: 2 / 3;
}
.css-grid-item__create-para3-div{
margin-left:40px;
margin-top:30px;
grid-column: 1 / -1;
grid-row: 3 / 4;
}
.css-grid-item__create-button-div{
align-self: center;
justify-self:center;
grid-column: 1 / -1;
grid-row: 4 / 5;
}
The page looks the following:
As its visible, the app-create-component
and app-practice-components
are not taking up the entire space of the cell. Their size seem to be dependent on the size of the content in them. How could I make them take up say 90% of the available size in the grid cell they are in. I tried using height:90%
and width:90%
but that didn't work