¿Cómo puedo mostrar tres columnas por fila?


He estado tratando de mostrar tres columnas por fila. ¿Es posible usar flexbox?

Mi CSS actual es algo como esto:

.mainDiv {
    display: flex;
    margin-left: 221px;
    margin-top: 43px;
}

Este código pone todo el contenido en una sola fila. Quiero agregar una restricción a solo muestra tres registros por fila.

Author: Sunil Garg, 2014-06-13

1 answers

Esto puede ser lo que estás buscando:

Http://jsfiddle.net/L4L67 /

body>div {
  background: #aaa;
  display: flex;
  flex-wrap: wrap;
}

body>div>div {
  flex-grow: 1;
  width: 33%;
  height: 100px;
}

body>div>div:nth-child(even) {
  background: #23a;
}

body>div>div:nth-child(odd) {
  background: #49b;
}
<div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
</div>
 71
Author: Barun,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-05 15:32:08