flex容器的属性flex-wrap用法

内容大于盒子宽度

<style type="text/css">
.bigbox{
width: 500px;
height: 400px;
background:#ff0000;
display: flex;
flex-direction: row;
flex-wrap: nowrap
}
.smallbox{
width: 200px;
height: 100px;
background: #f5f5f5;
margin: 10px;
}

</style>

</head>

<body>
<div class="bigbox">
<div class="smallbox">1</div>
<div class="smallbox">2</div>
<div class="smallbox">3</div>
</div>

</body>

</html>

<style type="text/css">
.bigbox{
width: 500px;
height: 400px;
background:#ff0000;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.smallbox{
width: 200px;
height: 100px;
background: #f5f5f5;
margin: 10px;
}

</style>

</head>

<body>
<div class="bigbox">
<div class="smallbox">1</div>
<div class="smallbox">2</div>
<div class="smallbox">3</div>
</div>

</body>

</html>

<style type="text/css">
.bigbox{
width: 500px;
height: 400px;
background:#ff0000;
display: flex;
flex-direction: row;
flex-wrap: wrap-reverse;
}
.smallbox{
width: 200px;
height: 100px;
background: #f5f5f5;
margin: 10px;
}

</style>

</head>

<body>
<div class="bigbox">
<div class="smallbox">1</div>
<div class="smallbox">2</div>
<div class="smallbox">3</div>
</div>

</body>

</html>

文章来自 www.96net.com.cn

posted @ 2022-08-21 10:15  学无边涯  阅读(354)  评论(0编辑  收藏  举报