Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
CSS resizing issue with image

I'm trying to use this background gradient and keep it centered on all screen sizes (Next.js, React, Sass)

gif of resizing

The JSX:

      <div className="bg-gradient-container">
          <Image src={Gradient} alt=""/>
      </div>

The css styles:

.bg-gradient-container {
  position: absolute;
  top: calc((470px - 32vh)*-1);
  left: calc((1920px - 100vw)/-2);
  width: 1920px;
  z-index: -10;
  animation: appear2 3s ease-in;
}

I've been trying things for a while and can't figure it out. In the gif, when I set it to Desktop mode then it resizes fine. When it's set to mobile, it resizes keeping the entire right side of the image in frame.

The weird thing is that when I hover over the image in devtools, it says that the width is 1920x1080, and the text content is the full viewport width (even though it doesn't take up the whole viewport ??). devtools image

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

try to use

left: 50%;
transform: translateX(-50%);

instead of left: calc((1920px - 100vw)/-2);

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda