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

113
Views
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
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!