小编Khe*_*epf的帖子

将 Reactstrap 轮播图像配置为响应的最佳方法

我已经做了很多查找,但令人惊讶的是关于 reactstrap carousel 图像响应的文档很少。

我的 ReactStrap carousel 响应式调整大小,但图像没有。

我研究/尝试过的选项:

  1. CSS 通过轮播组件本身中的 className 吗?这是我认为最好的一个,但我还没有找到可以正确调整图像大小的背景大小、高度和最大宽度的组合。

  2. 源集?鉴于轮播是一个组件,我不确定如何实现这个或任何其他内联属性

  3. 也许在轮播组件本身的某个地方?

  4. 或者我有更好的方法来修改图像吗?

  5. 或者@media 是通过 css 的答案?

`

const items = [
  {
    src: 'img1.png',
    altText: '',
    caption: ''
  },
  {
    src: 'img2.png',
    altText: '',
    caption: 'Freedom Isn\'t Free'
  },
  {
    src: 'img3.png',
    altText: '',
    caption: ''
  }
];

class HomeCarousel extends Component {
  constructor(props) {
    super(props);
    this.state = { activeIndex: 0 };
    this.next = this.next.bind(this);
    this.previous = this.previous.bind(this);
    this.goToIndex = this.goToIndex.bind(this);
    this.onExiting = this.onExiting.bind(this);
    this.onExited = …
Run Code Online (Sandbox Code Playgroud)

css image responsive-design reactjs reactstrap

1
推荐指数
2
解决办法
1万
查看次数

标签 统计

css ×1

image ×1

reactjs ×1

reactstrap ×1

responsive-design ×1