Answers for "elements in a row using felx"

4

flexbox limit items per row

<style>
  .parent {
    display: flex;
    flex-wrap: wrap;
  }

  .child {
    /* percent per item in row. 
    33% = limit to 3 per row. */
    flex: 1 0 33%; 
    margin: 5px;
    height: 100px;
    background-color: blue;
  }
</style>

<div class="parent">
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
</div>
Posted by: Guest on December-31-2020

Code answers related to "elements in a row using felx"

Browse Popular Code Answers by Language