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

200
Views
How to insert backgroun image in card in react?

I want to insert an image as background in card.I have saved the image in public/img/login.png .The image isn't shown..I'm using coreui react admin template.This is my code ::

<CCard className="text-white bg-primary py-5 d-md-down-none " style={{ width: '44%' , backgroundImage: "url(/login.png)" }}>
  <CCardBody className="text-center ">
     <div>
        <h2>Sign up</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
        <Link to="/register">
          <CButton color="primary" className="mt-3" active tabIndex={-1}>Register</CButton>
        </Link>
      </div>
    </CCardBody>
</CCard>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have created a assest folder inside of your root folder then you can add a images folder there and take the relative path and import it in the background image url.

import the image

import Yourimage from '../images/background_image.png';

var imgStyle= {
  backgroundImage: `url(${Yourimage})`
};

class ImgComponent extends Component {
  render() {
    return (

      <div style={imgStyle}>
      </div>
    );
  }
}
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!