用CSS以相反的顺序包装弹性项目

使用带有wrap-reverse值的 flex-wrap属性以相反顺序包装flex-items。

示例

您可以尝试运行以下代码来实现回绕

<!DOCTYPE html>
<html>
   <head>
      <style>
         .mycontainer {
            display: flex;
            background-color: #D35400;
            flex-wrap: wrap-reverse;
         }
         .mycontainer > div {
            background-color: white;
            text-align: center;
            line-height: 40px;
            font-size: 25px;
            width: 100px;
            margin: 5px;
         }
      </style>
   </head>
   <body>
      <h1>Quiz</h1>
      <div class = "mycontainer">
         <div>Ans1</div>
         <div>Ans2</div>
         <div>Ans3</div>
         <div>Ans4</div>
         <div>Ans5</div>
         <div>Ans6</div>
         <div>Ans7</div>
         <div>Ans8</div>
         <div>Ans9</div>
      </div>
   </body>
</html>