六、弹性盒

六、弹性盒

父盒子设置:

display:-前缀-flex; 表示父盒子是弹性盒容器,自动可以将盒子并排显示

子盒子设置:

只设置宽度,不设置浮动,就可以达到并排显示。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
.box {
width: 600px;
height: 200px;
border: 1px solid #000;
/* 父盒子弹性盒容器 */
display: -webkit-flex;
}
.box .no1 {
/* 子盒子不要书写浮动 */
width: 100px;
height: 200px;
background-color: green;
margin-right: 10px;
}
.box .no2 {
/* 子盒子不要书写浮动 */
width: 200px;
height: 200px;
background-color: blue;
margin-right: 10px;
}
.box .no3 {
/* 子盒子不要书写浮动 */
width: 100px;
height: 200px;
background-color: green;
}

NIUXDA.png

点击查看

本文标题:六、弹性盒

文章作者:Mango

发布时间:2020年06月30日 - 21:39:35

最后更新:2020年06月30日 - 21:44:19

原始链接:https://mango185.github.io/post/3f63028d.html

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。

-------------------本文结束 感谢您的阅读-------------------