调整窗口大小时将项目推到新行(显示 Flex 列)

问题描述 投票:0回答:0

我有 3 个带显示的项目列:flex 和 flex wrap: wrap to them。我的想法是让它响应,当我调整列中窗口项目的大小时将其他项目向下推(将下一个项目移到新行)。

现在找不到解决方案,可能很简单。

.parent{
    position: relative;
    width: 100%;
    height: 600px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;

}

.child{
    position: relative;
    width: 333px;
    height: 100%;
    background-color: rgb(60, 114, 96);
    margin-bottom: 50px;
}


.other{
    position: relative;
    width: 100%;
    height: 200px;
    background-color: black;
}
<!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>Document</title>
    <link rel="stylesheet" href="demo.css" type="text/css">
</head>
<body>

    <div class="parent">
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
    </div>

    <div class="other"></div>

</body>
</html>

html css flexbox window css-position
© www.soinside.com 2019 - 2024. All rights reserved.