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

373
Views
¿Por qué la imagen de fondo no ocupa el ancho completo en React?

Detalles de la pregunta:

Estaba tratando de configurar la imagen de fondo para que reaccionara, pero el posicionamiento no funciona correctamente. La imagen se amplía mucho, además, cuando cambio la propiedad de tamaño de fondo de la cubierta al contenido, se apretará hacia el centro en lugar de tomar todo el ancho del contenedor.

Reaccionar componente

 import React from 'react' import arrow from '../images/icon-arrow-down.svg' function Showcase() { return ( <div> <section className="showcase"> <div className="overlay"> <h1>We are creative</h1> <img src={arrow} alt="" /> </div> </section> </div> ) } export default Showcase; ----------

Código CSS

 **<!-- language: lang-css -->** /*ShowCase*/ .showcase{ background-image: url('./images/mobile/image-header.jpg'); height:100vh; background-size: cover; background-position: center bottom; background-repeat: no-repeat; background-size: 100% } .showcase .overlay{ height:512px; display:flex; align-items: center; justify-content: center; } <!-- end snippet -->

La vista previa de salida es [1]: https://i.stack.imgur.com/M1NRu.jpg

about 4 years ago · Juan Pablo Isaza
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!