0

I defined ...

container{    
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
}

And the items inside that container are defined...

item{    
    border: 0.5px solid rgb(117, 115, 115);
    position: relative;
    width: 10%;
    height: 22%;
    display: block;
    margin: 2%;
}

I was expecting rows of items with the height and width I defined, basically boxes in rows. But the items don't have a height of 22% of the container as I defined, they are just stripes with no space between.

enter image description here

1 Answers1

0

The % unit for height won't work that way since there is not height set in the parent element.

Try using vh using for the parent container like this,

.container{    
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    height: 100vh;                /* add this line */
}

Output: enter image description here

SandyKrish
  • 222
  • 1
  • 11