CSS中Flex布局强制换行的问题
Flex布局如何设置每行元素不能大于3个,大于3个就强制换行,有没有办法实现(不能加div,加div就不灵活了),如果实现?谢谢<!doctypehtml><html><...
Flex布局如何设置每行元素不能大于3个,大于3个就强制换行,有没有办法实现(不能加div,加div就不灵活了),如果实现?谢谢
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
div {
display: flex; flex-flow: row; flex-wrap: wrap
}
div>div {
border: solid; width: 100px; height: 100px; margin: 10px
}
</style>
</head>
<body>
<div>
<div>box1</div>
<div>box2</div>
<div>box3</div>
<div>box4</div>
<div>box5</div>
<div>box6</div>
<div>box7</div>
<div>box8</div>
<div>box9</div>
<div>box10</div>
</div>
</body>
</html> 展开
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
div {
display: flex; flex-flow: row; flex-wrap: wrap
}
div>div {
border: solid; width: 100px; height: 100px; margin: 10px
}
</style>
</head>
<body>
<div>
<div>box1</div>
<div>box2</div>
<div>box3</div>
<div>box4</div>
<div>box5</div>
<div>box6</div>
<div>box7</div>
<div>box8</div>
<div>box9</div>
<div>box10</div>
</div>
</body>
</html> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询