I have two grids. One is the main layout. The other is a form that uses a grid in that layout:
my-grid {
display: grid;
grid-template-areas: "hd hd hd hd hd hd hd hd hd hd hd hd"
"nav nav nav nav nav nav nav nav nav sch sch sch"
"sd sd sd ct ct ct ct ct ct ct ct ct"
"ft ft ft ft ft ft ft ft ft ft ft ft ";
grid-gap: 0px;
}
/* this is inside the my-grid main layout */
form {
display: grid;
grid-template: repeat(10,1fr) / repeat(4, 1fr);
padding: .5em;
min-height:0;
min-width:0;
}
<div class="my-grid">
<form>
<label>label1</label>
<input type="text">
<label>label2</label>
<input type="text">
<label>label3</label>
<input type="text">
<label>label4</label>
<input type="text">
<label>label5</label>
<input type="text">
<label>label6</label>
<input type="text">
<label>label7</label>
<input type="text">
<label>label8</label>
<input type="text">
<textarea rows="15">A comment</textarea>
</form>
</div>
https://codepen.io/anon/pen/WJEeqV
In that form there is a textarea (15 rows), but because it is big, it makes all the other elements big. How do I stop that textarea from making all the other elements in my form grid the same size?
If I only have display: grid
, only that row with the textarea makes things big. For example, I have a save button next to it and it has grown the size of the textarea.
Is display:grid
without anything else the "implicit grid"?
I am able to display all correctly without the areas, and I set the min-height
of my button, but I don't know if this is the "correct" way to do things. This appears to be a normal HTML problem, not grid specific, but I do not know.
I believe this is a classic table row problem. If I substitute my search and use table and row instead of css-grid, I get many more answers that are useful.