Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
327 views
in Technique[技术] by (71.8m points)

html - Carousel responsize size, all images same size

I have an carousel. My idea is that every image should be the same size, but the size should still be responsive. So like the width should be 100% and the image 16:9, I hope u get what I mean.

So here is my code:

<Carousel>
          {slide.map(slideItem => (
            <Carousel.Item>
              <a href={"/news/" + slideItem.path}>
                <div style={{ width: '100%'}}>
                  <img
                    style={{ overflow: 'hidden'}}
                    className="w-100 rounded-corners"
                    src={slideItem.img_path}
                    alt={slideItem.img_des}
                  />
                </div>
              <Carousel.Caption>
                <div
                  className="slider-subtitle font-standard"
                >
                  {slideItem.subtitle}
                </div>
              </Carousel.Caption>
              </a>
            </Carousel.Item>
          ))}
        </Carousel>

What i have to add in the style tag at the div and at the image, that all images which are mapped to the carousel haves the same size?

(This Carousel is made with react, and is from react-bootstrap, dont know if that matters. )

question from:https://stackoverflow.com/questions/66063661/carousel-responsize-size-all-images-same-size

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...