弹性布局

<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Document</title> </head> <style>     .box{         width: 400px;         height: 300px;         border: solid 1px springgreen;         /* 设置弹性容器 */         display:flex;         /* 横向反向排列,等同于 有浮动   */         /* flex-direction: row-reverse; */         /* 竖着排列 反向排列,*/         /* flex-direction: column-reverse; */         /* 成不开换行 */         flex-wrap:wrap;         /* 换行反向排列 */         /* flex-wrap:wrap-reverse */         /* 靠右边 */         /* justify-content: flex-end; */         /* 剧中 */         /* justify-content: center; */         /* 最外侧两边的距离加起来等于 两个元素的距离 */         /* justify-content: space-around; */         /* 元素之间等距离 */         /* justify-content: space-evenly; */         /* 竖着排列靠下 */         /* align-content: flex-end; */         /* 需要设置成(撑不开换行)才能生效*/         align-content: center;     }     .box div{         width: 50px;         height: 50px;         border: 1px solid steelblue;

    } </style> <body>     <div class="box">         <div>第一个盒子</div>         <div>第2个盒子</div>         <div>第3个盒子</div>         <div>第4个盒子</div>     </div> </body> </html>
上一篇:前端开发最详细、最易懂的Flex弹性布局(含案例)


下一篇:CSS弹性盒子