代码示例:(标识:cssref_justify-items_direction)
<!DOCTYPE html>
<html>
<head>
<style> 
#container {
  width: 50%;
  aspect-ratio: 2/1;
  border: 1px solid black;
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-items: start;
  direction: rtl;
}

#container > div {
  border: 1px solid black;
}

.blue {
  background-color: lightblue;
  width: 50%;
}

.red {
  background-color: coral;
  width: 40%;
}

.green {
  background-color: lightgreen;
  width: 60%;
}
</style>
</head>
<body>

<h1>设置 justify-items 以及 direction: rtl</h1>

<p>网格项目沿行内方向在网格容器的开始处对齐。行内方向随 direction 属性值“rtl”发生变化,因此现在direction方向上的容器的起点位于容器的右侧而不是左侧。</p>

<div id="container">
  <div class="red">红色</div>
  <div class="blue">蓝色</div>
  <div class="green">绿色</div>
  <div class="red">红色</div>
</div>

</body>
</html>
运行结果: