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

126
Views
Establecer altura 100vh para siguiente/imagen

es increíble. He intentado por todos los medios obtener el componente de imagen de nextjs a 100vh, se supone que el ancho es automático. Revisé toda la documentación y sus ejemplos con la propiedad de diseño, pero nada encaja.

Objetivo: altura 100vh, ancho: automático

 import img6 from "./image.jpg"; import styles from "../styles/slider.module.css"; export default function about() { return ( <> <div className={styles.slider}> <Image alt="" src={img6} // layout="responsive" // layout="fill" // objectFit="cover" className={styles.image} // style={{ height: "100vh" }} // width="300px" // height="100%" /> </div> </> ); }
 .slider { display: block; height: 100vh; } .image { height: 100vh; width: auto; }

Con html es fácil:

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> .img{ height: 100vh; } </style> </head> <body> <img src="http://placeimg.com/640/480/animals/sepia" alt="" class="img"> </body> </html>

kann mir das jemand erklären????

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

El div principal debe tener una posición relativa

 <div className={styles.slider}> <Image alt="" src={img6} layout="fill" /> </div> .slider { display: block; height: 100vh; position: relative; }
about 4 years ago · Santiago Gelvez Report

0

Para aquellos que estén interesados, lo resolví usando layout='raw' , que aún es experimental.

Problemas relacionados con Github:

  • https://github.com/vercel/next.js/issues/18637
  • https://github.com/vercel/next.js/issues/35493

Y next.config.js :

 experimental: { images: { layoutRaw: true } }
about 4 years ago · Santiago Gelvez 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!