CSS Property:
grid-auto-rows:

Result:
1
Hello
2
3
4
5
6
CSS Code:
#myDIV {
  display: grid;
  grid-auto-rows:max-content;
}
Click the property values above to see the result
W3Schools.com - Play it