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

140
Views
la configuración de la imagen de fondo de los accesorios no funciona

¿Cómo puedo configurar la imagen de fondo de props. Probé diferentes variaciones pero no puedo hacer que funcione. css se muestra en html pero la imagen no se muestra.

 const cover = "http://www.w3schools.com/css/trolltunga.jpg"; class App extends React.Component { render(){ return( <div> <h2>Hey</h2> <Child image = {cover} /> </div> ) } } class Child extends React.Component{ render(){ const style = { backgroundImage: "url("+this.props.image+")", backgroundSize: "100% 100%" } return( <div style={style}></div> ) } } ReactDOM.render( <App />, document.getElementById("app") )
 <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react-dom.min.js"></script> <div id="app"></div>

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

El problema es que tu div está empty , por eso la imagen background no está visible. pon algo de contenido dentro de eso, será visible, prueba esto:

 <div style={style}>Add background</div>

verifique el jsfiddle , su código funciona correctamente. Acabo de agregar la línea anterior en eso: https://jsfiddle.net/0z38gozj/

over 4 years ago · Santiago Trujillo 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!