Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

220
Vistas
How to position element's in specific way?

I have some html div's and simple css style, something like this:

.wrap{
  display: flex;
  flex-direction:row;
  justify-content: space-around;
  align-items: center;
}
.child{
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background-color: lightBlue;
  display:flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
}
<div class='wrap'>
  <div class='child'>
    0
  </div>
    <div class='child'>
    1
  </div>
    <div class='child'>
    2
  </div>
    <div class='child'>
    3
  </div>
    <div class='child'>
    4
  </div>
    <div class='child'>
    5
  </div>
    <div class='child'>
    6
  </div>
    <div class='child'>
    7
  </div>
    <div class='child'>
    8
  </div>
    <div class='child'>
    9
  </div>
    <div class='child'>
    10
  </div>
</div>

I would like to change position of this element on mobile device to something like this:

enter image description here

How can I do this? I was thinking first of all about flex-wrap and order?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can do it like below:

.wrap {
  display: flex;
  flex-direction: row;
  flex-wrap:wrap; /* enable the wrap*/
  justify-content:center; /* center everything */
}

/* create a hidden element taking full width
   used to seperate our elements
*/
.wrap:before {
  content:"";
  flex-basis:100%;
  order:1
}
/* put all even elements after the seperation to have a new row*/
.child:nth-child(even) {
  order:2;
}

.child {
  width: 45px;
  height: 45px;
  margin:5px;
  border-radius: 50%;
  background-color: lightBlue;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
}
<div class='wrap'>
  <div class='child'>
    0
  </div>
  <div class='child'>
    1
  </div>
  <div class='child'>
    2
  </div>
  <div class='child'>
    3
  </div>
  <div class='child'>
    4
  </div>
  <div class='child'>
    5
  </div>
  <div class='child'>
    6
  </div>
  <div class='child'>
    7
  </div>
  <div class='child'>
    8
  </div>
  <div class='child'>
    9
  </div>
  <div class='child'>
    10
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Denunciar

0

  • remove display: flex from .wrap and give .child display: inline-flex

CSS will be like that_

.wrap{
  text-align: center;
}
.child{
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background-color: lightBlue;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda