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


使用值space-around 的justify-content 属性可在 flex-item 之间增加空格。

尝试运行以下代码来实现 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 日

119 次浏览

开启职业生涯生涯

完成课程获取认证

开始使用
广告
© . All rights reserved.