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

167
Vistas
How to make an image fit only 50% of the screen in NextJS

I'm trying to make a image fit only 50% of the screen in NextJS. NextJS provides an Image component that we have to use and not the image element. That Image component already has its own inline styling for the image element and wraps it in a styled span element. Currently I wrap that Image component in a span tag so I can style it but I'm finding it difficult to make it fit only 50% of the screen.

Code:

<div className='pagewrapper'>
  <section className='authpages_section'>
    <span className='authpages_heroimg'>
      <Image src='/assets/hero.png' alt='an hero img' />
    </span>
  </section>
  <section className='authpages_section'>
   <Logo />
   <div>{children}</div>
  </section>
</div>

styling:
.pagewrapper {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;

  .authpages {
     &_section {
       flex-basis: 50%;
       height: 100vh;
     }

     &_heroimg {
       display: inline-flex;
     }
   }
}

Here's a visual representation:

visual representation

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

0

Can you do it like this:

  1. For the .authpages_section set width: 50%
  2. For the Image element - add some class and set it styles to max-width: 100%

Update To achive what you need to do it remove the layout="fill" property, so your component will actually look like:

 <Image
   src={HeroImg}
   alt="an hero img"
 />
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