Bootstrap carousel width and height
Are you trying to make it responsive? If you are then I would just recommend the following:
.tales {
width: 100%;
}
.carousel-inner{
width:100%;
max-height: 200px !important;
}
However, the best way to handle this responsively would be thru the use of media queries like such:
/* Smaller than standard 960 (devices and browsers) */
@media only screen and (max-width: 959px) {}
/* Tablet Portrait size to standard 960 (devices and browsers) */
@media only screen and (min-width: 768px) and (max-width: 959px) {}
/* All Mobile Sizes (devices and browser) */
@media only screen and (max-width: 767px) {}
/* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
@media only screen and (min-width: 480px) and (max-width: 767px) {}
/* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
@media only screen and (max-width: 479px) {}
If you use bootstrap 4 Alpha and you have an error with the height of the images in chrome, I have a solution: The documentation of bootstrap 4 says this:
<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block img-fluid" src="..." alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="..." alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="..." alt="Third slide">
</div>
</div>
</div>
Solution:
The solution is to put "div" around the image, with the class ".container", like this:
<div class="carousel-item active">
<div class="container">
<img src="images/proyecto_0.png" alt="First slide" class="d-block img-fluid">
</div>
</div>
I recommend the following for Bootstrap 3
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
min-height: 500px; /* Set slide height here */
}
I know this is an older post but Bootstrap is still alive and kicking!
Slightly different to @Eduardo's post, I had to modify:
#myCarousel.carousel.slide {
width: 100%;
max-width: 400px; !important
}
When I only modified .carousel-inner {}
, the actual image was fixed size but the left/right controls were displaying incorrectly off to the side of the div
.