繁体   English   中英

如何在反应多轮播中居中图像?

[英]how to center image in react-multi-carousel?

我是新手,尝试使用 react-multi-carousel 构建品牌轮播。 图像显示正确,但我想使图像居中。 试图写 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"}}/>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM