Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carousel images not horizontally centered when they're narrower than the carousel #18181

Closed
cvrebert opened this issue Nov 5, 2015 · 3 comments

Comments

@cvrebert
Copy link
Collaborator

cvrebert commented Nov 5, 2015

Refs #18140 (comment)

When a slide image is narrower than the carousel itself, it becomes left-aligned instead of centered.

@bassjobsen
Copy link
Contributor

I do not think this is an issue. The carousel requires only images having the same dimensions and the .carousel should never be wider than these images. We can add this to the docs.

When on of the images is smaller, center it only helps when the height is the same for all images. To center it you have to add the center-block class to the img element in your HTML, according the refactoring #18161; for instance <img class="carousel-item-img img-fluid center-block" src="">

when you have to add images with different dimensions you will have to change your images. Put the smaller images on a white or transparent background having the same dimension as your largest image with a image editor.

@mdo
Copy link
Member

mdo commented Dec 5, 2016

Not going to do anything about this on our end. Closing as a won't fix.

@mdo mdo closed this as completed Dec 5, 2016
@asifalmani
Copy link

asifalmani commented Sep 29, 2017

I tried this and its working fine for me.

.carousel-inner {
	.item {
		&.active {
			img {
				max-height: 650px;
  				margin: auto;
			}
		}
	}
}

@twbs twbs locked and limited conversation to collaborators Feb 5, 2018
@twbs twbs unlocked this conversation Feb 5, 2018
@twbs twbs locked as resolved and limited conversation to collaborators Feb 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants