让 Bootstrap 的 Carousel 既居中又响应? [英] Make Bootstrap's Carousel both center AND responsive?

查看:22
本文介绍了让 Bootstrap 的 Carousel 既居中又响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的轮播图像位于中心(水平),这不是默认设置.我遵循本主题上的解决方案.

I want my carousel images to be at the center (horizontally), which is not by default. I follow the solution at this topic.

但是,使用此解决方案时,当轮播被调整大小并小于图像时,图像会被裁剪而不是默认缩放.

However, using this solution, when the carousel is resized and smaller than the image, the image is cropped instead of scaling as default.

如何使我的图像居中,但保持其拉伸到轮播项目?

How can I both center my image, but keep it to stretch to the carousel item?

推荐答案

现在(在 Boostrap 3+ 上)很简单:

Now (on Boostrap 3+) it's simply:

.carousel-inner img {
  margin: auto;
}

这篇关于让 Bootstrap 的 Carousel 既居中又响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆