如何在react多转盘中居中显示图像



我是react的新手,尝试使用react multi-carroway构建品牌转盘。图像显示正确,但我想将图像居中。尝试编写css,但它不适用于旋转木马。这是如何实现的,或者我必须使用任何其他旋转木马吗?`

<Grid item xs={12}>
<Carousel
responsive={responsive}
infinite={true}
arrows={true}>
<Image src={abt.logo_carousel.url}responsive/>
<Image src={abt.logo_carousel1.url}responsive/>
<Image src={abt.logo_carousel2.url}responsive/>
<Image src={abt.logo_carousel3.url}responsive/>
</Carousel>
</Grid>`

在标签内部编写样式。就像这个

<img src="..." style={{width:300,marginLeft:"auto",marginRight:"auto"}} />

我有点迟到了,但希望这能帮助到别人(对我来说很有效(:

<img src={source} style={{marginLeft: "auto", marginRight: "auto", display: "flex", justifyContent: "center"}}/>

最新更新