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

173
Vistas
How to make a div resize based on its background image using tailwind

So i'm using the library called Swiper for my swiper , my code looks like this :

import SwiperCore, { Pagination } from "swiper";

SwiperCore.use([Pagination]);

const MainCarousel = () => {
  return (
    <Swiper
      pagination={true}
      spaceBetween={50}
      slidesPerView={1}
      onSlideChange={() => console.log("slide change")}
      onSwiper={(swiper) => console.log(swiper)}
    >
      <SwiperSlide>
        <div className="w-screen h-screen max-h-max bg-first-car bg-cover">
          Hello
        </div>
        {/* <img src={Car1} alt=""></img>  */}
      </SwiperSlide>
      <SwiperSlide>
        {/* <img src={Car2} alt=""></img> */}
        <div className="w-screen h-screen bg-second-car bg-cover">hello</div>
      </SwiperSlide>
      <SwiperSlide>
        {/* <img src={Car3} alt=""></img> */}
        <div className="w-screen h-screen bg-third-car bg-cover">hello</div>
      </SwiperSlide>
    </Swiper>
  );
};

export default MainCarousel;

Here is what i'm trying to achieve

mine either goes to full screen if i set h-screen , but doesn't work to just fit the image and that's it , any tips ?

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