【css】多个子项目中间间隔固定排列

<!DOCTYPE html>
<html>
<head>
<style>
.flex-container {
  display: flex;
  width:640px;
  flex-wrap:wrap;
  align-items: stretch;
  background-color: #f1f1f1;
}

.flex-container > div {
  background-color: DodgerBlue;
  color: white;
  width: 100px;
  margin: 10px;
  text-align: center;
  line-height: 75px;
  font-size: 30px;
  flex-shrink:0;
  flex-grow:1;
}
.flex-container > div:first-child {
   margin-left: 0;
} 
.flex-container > div:nth-child(5n+1){
   margin-left: 0;
}
.flex-container > div:nth-child(5n){
   margin-right: 0;  
}

</style>
</head>
<body>
<h1>The flex-grow Property</h1>

<p>Make the third flex item grow eight times faster than the other flex items:</p>

<div class="flex-container">
  <div >1</div>
  <div >2</div>
  <div >3</div>
  <div >4</div>
  <div >5</div>
  <div >6</div>
  <div >7</div>
  <div >8</div>
  <div >9</div>
  <div >10</div>
  <div >11</div>
  <div style="background:transparent">12</div>
  <div style="background:transparent">13</div>
  <div style="background:transparent">14</div>
  <div style="background:transparent">15</div>
</div>

</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值