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

50
Vistas
Targeting the last odd element with a given class

I have a dynamic photo list, pulled from the CMS. Photos are vertical and horizontal. I am trying to create a "dynamic grid" where all horizontal photos are 100% wide and vertical photos are 50% wide. I was able to achieve this with the help of JS. codepen with my code

However, I have trouble targeting the last odd vertical shot that has a horizontal shot in front of it. I would like this photo to be 100% wide as well, so that there would be no unnecessary break.

I tried to use :nth-child() pseudo class but, that was not helpful at all. - its select only first child.

.wide + .portfolio-item:nth-last-child(odd) {
  width: 100%;
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Okay, I tried to overthink it, a solution was very easy - on portfolio-item I should use:

  flex-grow: 1;
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