CSS justify-content 属性 space-between 值的作用


使用伴有值 space-around 的justify-content 属性可在弹性项目之间添加空格。

您可以尝试运行以下代码来实现 space-between 值

示例

实时演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         .mycontainer {
            display: flex;
            background-color: red;
            justify-content: space-between;
         }
         .mycontainer > div {
            background-color: orange;
            text-align: center;
            line-height: 60px;
            font-size: 30px;
            width: 100px;
            margin: 5px;
         }
      </style>
   </head>
   <body>
      <h1>Quiz</h1>
      <div class = "mycontainer">
         <div>Q1</div>
         <div>Q2</div>
         <div>Q3</div>
         <div>Q4</div>
      </div>
   </body>
</html>

更新时间:2020 年 6 月 24 日

117 次浏览

启动您的 职业

完成课程即可获得认证

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