CSS flex-directionにrow-reverseを指定て要素を逆にする

環境
Google Chrome 112.0.5615.49(Official Build) (64 ビット)
Windows 10 Home 64bit

書式
display: flex;
flex-direction: row-reverse;
row-reverseは、水平方向で要素を逆にします。

使用例

<!DOCTYPE html>
<html>
<head>
<style>
  /*親クラスの定義*/
  .parentA { 
    display: flex;
    flex-direction: row-reverse;; /*水平方向で要素の並び順を逆にする*/
    width: 150px;
    height: 80px;
    border: 1px solid #000;
  }
  /*子クラスの定義*/
  .childA { 
    background: skyBlue;
    text-align: center;
    width: 80px;
    border: 1px solid #000;
  }
</style>
</head>
<body>

<div class="parentA">
  <div class="childA">東京</div>
  <div class="childA">大阪</div>
  <div class="childA">福岡</div>
</div>

</body>
</html>

実行結果
要素「class="childA"」を水平方向で逆にします

CSS

Posted by arkgame