123456789101112131415161718192021222324252627282930313233343536 |
- <!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>体验flex布局</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- }
- .box {
- /* 视觉效果: 子级一行排列/水平排列 */
- /* 水平排列: 默认主轴在水平, 弹性盒子都是沿着主轴排列 */
- display: flex;
- height: 200px;
- border: 1px solid #000;
- }
- .box div {
- width: 100px;
- height: 100px;
- background-color: pink;
- }
- </style>
- </head>
- <body>
- <div class="box">
- <div>1</div>
- <div>2</div>
- <div>3</div>
- </div>
- </body>
- </html>
|