Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

320
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!