You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<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> <style> /* 如果父元素的宽度不够子元素宽度的总和,子元素会被压缩,以便子元素充分的显示 */ #div0 { width: 300px; background-color: blue; display: flex; /* 设置 flex 布局的方向 */ /* flex-direction: row; */
/* 设置 flex 的换行效果 */ /* flex-wrap: wrap; */
/* flex-flow 是 flex-direction 和 flex-wrap 的简写*/ flex-flow: row wrap; } #div0 div { width: 100px; height: 100px; background-color: aqua; } </style> </head> <body> <div id="div0"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div> </body> </html>
|