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

319
Vistas
aligning images in React JS side by side using CSS map method

To align images side by side that are written using map method in React JS and CSS To align images side by side that are written using map method in React JS and CSS To align images side by side that are written using map method in React JS and CSS

before:

enter image description here

import React from 'react'
import HomeFooterImages from "./HomeFooterImages";

const HomeFooterDetails = () => { //landing page footer images not wokring
  return (
        <div className="home5Main">
            {
              HomeFooterImages.map((curElem) =>
              {
                  return (
                      <div className="home5Main1">
                            <img className="home5Main1Img" src={curElem.img} />
                      </div>
                      
                  )
              })
            }
          </div>
  )
}


export default HomeFooterDetails;

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

0

For following results

enter image description here

Add following CSS:

.home5Main {
  margin-top: 5%;
  border: 2px solid grey;
  width: 100%;
  height: 400px;
}

.home5Main1Img {
  float: left;
  width: 13%;
  height: auto;
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

You Should use FlexBox for this scenario. Bydefault direction of flex will be row-wise.

.home5Main1 {
    padding:"5px";

}
.home5Main1Img{
  width: "200px";
  height: "400px";
}

.home5Main {
  display:"flex";
  width:"100%"
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

Code Solution:https://codesandbox.io/s/sharp-kare-np3e0?file=/src/App.js

import "./styles.css";
import { ImagesElement } from "./HomeFooterImages";
export default function App() {
  return (
    <div className="home5Main">
      {ImagesElement.map((curElem) => {
        return <img className="home5Main1Img" src={curElem.img} />;
      })}
    </div>
  );
}


.home5Main {
  display: flex;
  justify-content: space-evenly;
}

explanation: You are returning home5Main1 div for HomeFooterImages map function since you rendering div(which is block element) images will come one below the other. In my code, I am only returning images from map function which works and used flex just add little spice to it

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