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

115
Visualizações
Why wrapper width 100% limit all the items width in CSS?

I was making carousel with react. This is my carousel component. i got data from server.

const VideosRow = (props) => {
  return (
    <Fragment>
      <div className={classes["video-carousel"]}>
        {props.data.map((video) => {
          return (
            <div className={classes["video-items"]}>
              <Video key={video._id} image={video.overviewThumbSrc} />
            </div>
          );
        })}
      </div>
    </Fragment>
  );
};

and this is my css file

.video-carousel {
  display: flex;
  overflow: hidden;
  padding-left: 4rem;
  height: 14.9rem;
  width: 100%;
}

.video-items {
  position: relative;
  width: 20vw;
  height: 100%;
  margin-left: 0.5rem;
}

.video-items img {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
}

width with 100% As you can see, if i give 100% width to carousel container, it automatically limit my carousel items. regardless of width property of items However, if i changed container width as hard-coded value,

.video-carousel {
  display: flex;
  overflow: hidden;
  padding-left: 4rem;
  height: 14.9rem;
  width: 130rem;
}

width with hard coded value It works well!!

What did i do wrong here? My logic was : i set width of video-items as 20vw, so whenever window size change, my items will have dynamic value according to their ratio. Because of video-items width, if i set container with as 100%, it will automatically expanded to cover all items. However, with overflow property, rest of videos will be hidden in window view.

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