<!DOCTYPE HTML>
<html><head>
  <meta charset="utf-8">
  <title></title>
  <style type="text/css">
.grid {
  display: grid;
}

.sfb { align-self:baseline; }
.slb { align-self:last baseline; }

.vl { writing-mode: vertical-lr; }

</style>
</head>
<body>

<div class="grid"><input class="slb"></div>
<div class="grid"><input class="sfb"></div>

<div class="grid"><input class="slb vl"></div>
<div class="grid"><input class="sfb vl"></div>

</body>
</html>