<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-align-3/#align-abspos">
<style>
body {
  margin: 0;
}

.container {
  writing-mode: vertical-lr;
  direction: ltr;
  display: inline-block;
  position: relative;
  margin: 20px;
  border: solid 4px;
  width: 40px;
  height: 40px;
}

.item {
  writing-mode: vertical-rl;
  direction: ltr;
  position: absolute;
  background: green;
  inset: 0;
}

.item::before {
  width: 20px;
  height: 20px;
  content: '';
  display: block;
}

.rtl {
  direct