Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

321
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda