【问题标题】:how to center image in react-multi-carousel?如何在反应多轮播中居中图像?
【发布时间】:2021-09-27 02:50:04
【问题描述】:

我是 react 新手,正在尝试使用 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>`

【问题讨论】:

  • 您可以包含您的代码以便更好地理解
  • @AnonymousCoder 我已经添加了代码
  • 图片居中或完整轮播需要什么??
  • carousel div里面的logo。在上面的情况下,里面的图像
  • 您的图片已经在轮播容器中居中

标签: reactjs react-multi-carousel pure-react-carousel


【解决方案1】:

在你的标签里面写样式。像这样

&lt;img src="..." style={{width:300,marginLeft:"auto",marginRight:"auto"}} /&gt;

【讨论】:

  • 样式有效,但无法在中心显示项目
猜你喜欢
  • 2015-08-12
  • 2021-09-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-20
  • 1970-01-01
  • 1970-01-01
  • 2023-04-07
相关资源
最近更新 更多