How to make bootstrap carousel image responsive?
Remove the following CSS rules from respective files:
In home.php file
.carousel .item>img {
position: absolute;
top: 0;
left: 0;
max-width: 100%;
height: 100%;
}
in carousel.css
.carousel-inner > .item > img {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
height: 500px;
}
Also, add margin-top: 51px;
to .carousel
class in carousel.css file and remove height:500px
from the same class, because you have fixed navbar.
How to make Bootstrap 4 carousel images responsive?
You do not need a wrapper or something like that. The default styling for the .active .carousel-item is display: flex.
You will need to add
.carousel-item.active,
.carousel-item-next,
.carousel-item-prev {
display: block;
}
to your custom css.
Bootstrap carousel responsive image
You could do this:
img {
height: 300px !important;
object-fit: cover;
}
Related Topics
How to Center-Justify The Last Line of Text in CSS
CSS - Inline Elements Ignoring Line-Height
CSS Calc Not Working in Safari and Fallback
Stripping Out HTML Tags from a String
Putting an Image Background Onto a CSS Triangle
What Is a Non-Replaced Inline Element
Multiple Distinct Pages in One HTML File
Load External CSS File in Body Tag
What Is The Correct Use of Schema.Org Sitenavigationelement
Get Parameters in The Url with Codeigniter
Preventing Canvas Clear When Resizing Window
CSS Padding Is Not Working in Outlook
Is There a 'Pointer-Events:Hoveronly' or Similar in CSS
How to Remove The Dotted Line Around The Clicked a Element in HTML