Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

366
Visualizações
Why Background Image not Taking Full Width in React

Question Details:

I Was Trying to set the background image in react but the positioning is not working properly. The Image gets zoomed a lot, Plus when I change the property of background-size from cover to contain, It will squeeze to the center instead of taking the full width of the container.

React Component

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;


----------

CSS Code

**<!-- 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 -->

The Preview of Output is [1]: https://i.stack.imgur.com/M1NRu.jpg

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda