0

well, im trying to make a flexbox flex-flow:row wrap; with cards inside it, with break line, but when it break the line the distance between the cards up and the cards bellow are too large, and put gap:0; doenst work, but if i took of the height of container it works ,if you go to the code on codepen increase the height of screen. https://codepen.io/racr-1/pen/ExRaPzJ

<!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>
</head>
    <style>
        body,html{
            margin: 0;
           width:100%; 
           height: 100%;
           
        }
        .div1{
           width:30%; 
           height: 100%;
           background-color: blue;
           display: flex;
           flex-flow: row wrap;
           padding: 10px;
           gap: 10px;
           
        }
        .card{
            width: 100px;
            height: 140px;
            background-color: gray;
        }
    </style>
<body>
    <div class="div1">
        <div class="card"></div>
        <div class="card"></div>
        <div class="card"></div>
        <div class="card"></div>
        <div class="card"></div>
    </div>
</body>
</html>
Sunlight
  • 1
  • 1

1 Answers1

-1

body,
html {
  margin: 0;
  width: 100%;
  height: 100%;
}

.div1 {
  width: 30%;
  height: min-content;
  background-color: blue;
  display: flex;
  flex-flow: row wrap;
  padding: 10px;
  column-gap: 10px;
}

.card {
  width: 100px;
  height: 140px;
  background-color: gray;
}
<div class="div1">
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
</div>
Andrei Fedorov
  • 3,689
  • 2
  • 13
  • 25