0

Im trying to make image to fit a div. Im using react-slideshow-image.

this is the CodSandbox : https://codesandbox.io/s/react-slide-imageshow-heightproblem-mforb?file=/src/App.js

return (
      <div className="App">
        <div style={{ width: "30%", height: "70px" }}>
          <Slide ref={this.slideRef} {...properties}>
            {slideImages.map((each, index) => (
                <img style={{ objectFit: 'contain', height : '100%'}} src={each} key={index} alt="sample" />
            ))}
          </Slide>
        </div>
      </div>

I want the images to fit the div , so i can make the div responsive. if the div height is 70px, so the images inside it will also be the same height:70px

I have tried this How to make an image fit the carousel?.

I have noticed that the <Slide > add divs so i looked at the docs and saw that you can add a property called cssClass that gets a string:

Use this prop to add your custom css to the wrapper containing the sliders. Pass your css className as value for the cssClass prop

but it doesnt seems to work and i didnt found any examples for it.

Amit Hagag
  • 46
  • 7

0 Answers0