 auto 1.4ch 1fr;
  grid-auto-flow: column;
  border: 1px solid;
  padding: 0 1px 0 2px;
  vertical-align: top;
  height: min-content;
}

item {
  /* smaller heights to fit into 800x600 */
  writing-mode: vertical-rl;
  text-orientation: sideways;
}
</style>

<body>

<section>
<grid>
  <item style="height:2ch">1</item>
  <item style="height:2ch">2</item>
  <item>3</item>
  <item style="height:2ch">4</item>
  <item>5</item>
</grid>

<grid>
  <item>1</item>
  <item style="height:2ch">2</item>
  <item>3</item>
