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

156
Views
How to set the background image in react js using external css?

I am trying to set the image in the background of the container via external css , but it says modules not found ,what is the correct path I should give in background-image....


     import React from 'react'
import './Login.css'
const Login = () => {
    return (
        <>
        <div className="container-fluid img-wrapper bg-danger">
        </div>
        </>
    )
}
export default Login

  *{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
     .img-wrapper{
        background-image:url(../public/login-bg.png);
        background-position: center center;
        background-size: cover;
        background-repeat: no-repeat;
        height:100vh;
    }



    
     
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It looks like you are facing the same issue as in this question: Use images in CSS files with ReactJS

You can add the photo to your public folder, since the server is served there. As provided in this Codesandbox: https://codesandbox.io/s/agitated-turing-gsnr3?file=/src/styles.css

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!