<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> .box { display: flex; flex-wrap: wrap; justify-content: space-around; } .item { width: calc(calc(100% / 3) - 10px); border: 1px solid blue; height: 30px; line-height: 30px; color: red; margin-bottom: 10px; } .item:nth-child(n+4) { margin-bottom: 0; } </style> </head> <body> <div class="box"> <div class="item">1</div> <div class="item">2</div> <div class="item">3</div> <div class="item">4</div> <div class="item">5</div> <div class="item">6</div> </div> </body> </html>
标签:flex,bottom,布局,height,wrap,calc,30px From: https://www.cnblogs.com/whlBooK/p/17513888.html