<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Flex demo 2</title>
  <style>
    .container {
      display: flex;
      flex-direction: column;/*改变主轴方向,column列从上往下,默认是row行从左往右*/
      width: 400px;
      height: 300px;
      border: 1px solid #ccc;
    }

    .item {
      flex: 1;
    }
    /* 总的是4份,每一项占一份 */
  </style>
</head>
<body>
  <div class="container">
    <div class="item" style="background-color: #0ff; width: 200px"></div>
    <div class="item" style="background-color: #ff0"></div>
    <div class="item" style="background-color: #f00"></div>
    <div class="item" style="background-color: #f0f"></div>
    <div class="item" style="background-color: #0ff"></div>
  </div>
</body>
</html>

  

相关文章:

  • 2021-12-31
  • 2022-12-23
  • 2021-12-02
  • 2021-06-14
  • 2021-12-29
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
猜你喜欢
  • 2021-06-18
  • 2022-12-23
  • 2021-05-13
  • 2022-12-23
  • 2021-07-12
  • 2021-12-24
  • 2021-12-03
相关资源
相似解决方案