CSS align-content 属性 flex-start 值的使用方法


使用取值flex-startalign-content属性将 flex 布局中的多条线设置在顶部。

示例

你可以尝试运行以下代码以实现flex-start值 −

实际演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         .mycontainer {
            display: flex;
            height: 200px;
            background-color: blue;
            align-content: flex-start;
            flex-wrap: wrap;
         }
         .mycontainer > div {
            background-color: orange;
            text-align: center;
            line-height: 60px;
            font-size: 30px;
            width: 100px;
            margin: 5px;
         }
      </style>
   </head>
   <body>
      <h1>Queue</h1>
      <div class = "mycontainer">
         <div>Q1</div>
         <div>Q2</div>
         <div>Q3</div>
         <div>Q4</div>
         <div>Q5</div>
         <div>Q6</div>
         <div>Q7</div>
         <div>Q8</div>
      </div>
   </body>
</html>

更新日期:2020 年 7 月 4 日

106 次浏览

开启您的职业生涯

通过完成本课程获取认证

开始学习
广告
© . All rights reserved.