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

174
Visualizações
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 à 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