How to make images the same height in a Bootstrap 5 carousel - html

I'm working on a carousel with Bootstrap 5. I want to make images to have the same size, no matter what size they are.
Current carousel:
I want the carousel to show the next image with the same height as the first one.
This is my html code:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<div id="carouselExampleInterval" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active" data-bs-interval="10000">
<img src="https://venemergencia.com/assets/Banner_principal_Mapa.8ec397bc.png?avif" class="d-block w-100" alt="...">
</div>
<div class="carousel-item" data-bs-interval="2000">
<img src="https://venemergencia.com/assets/Banner_principal_AVILA.2e5ec20a.png?avif" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="https://venemergencia.com/assets/Telesalud-COVID-19.1370e3f7.png?avif" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="https://img.freepik.com/vector-gratis/grupo-personal-medico-que-lleva-iconos-relacionados-salud_53876-43071.jpg?w=2000" class="d-block w-100 img-fluid" alt="...">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleInterval" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleInterval" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>

We can bang things into shape by using a zero-height/padding-bottom trick for the carousel container, full-size absolute positioning on the carousel items, and object-fit on the images.
.carousel-inner {
height: 0;
padding-bottom: 25%; /* this sets carousel aspect ratio (4:1 here) */
}
.carousel-item {
position: absolute !important; /* Bootstrap is insistent */
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.carousel-item img {
height: 100%; /* Bootstrap handles width already */
object-fit: cover; /* or 'contain' if you want stretch instead of crop */
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<div id="carouselExampleInterval" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active" data-bs-interval="10000">
<img src="https://via.placeholder.com/1200x300" class="d-block w-100" alt="...">
</div>
<div class="carousel-item" data-bs-interval="2000">
<img src="https://via.placeholder.com/600x2000" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="https://via.placeholder.com/100x300" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="https://via.placeholder.com/700x300" class="d-block w-100 img-fluid" alt="...">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleInterval" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleInterval" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>

But I want to make images have the same size, no matter what size they
are.
Use a background-image for each slide. Without adding custom size attributes to each individual image (which will lead to resolution issues), using a background image is the only solution.
An ideal solution would be to resize all of the photos so they are the exact same size.
.first {
background-image: url('https://venemergencia.com/assets/Banner_principal_Mapa.8ec397bc.png?avif');
}
.second {
background-image: url('https://venemergencia.com/assets/Banner_principal_AVILA.2e5ec20a.png?avif');
}
.third {
background-image: url('https://venemergencia.com/assets/Telesalud-COVID-19.1370e3f7.png?avif');
}
.fourth {
background-image: url('https://img.freepik.com/vector-gratis/grupo-personal-medico-que-lleva-iconos-relacionados-salud_53876-43071.jpg?w=2000');
}
.first,
.second,
.third,
.fourth {
background-size: cover;
background-position: center;
background-repeat: no-repeat;
width: 100%;
height: 800px;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<div id="carouselExampleInterval" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner first">
<div class="carousel-item active" data-bs-interval="10000"></div>
<div class="carousel-item second" data-bs-interval="2000"></div>
<div class="carousel-item third"></div>
<div class="carousel-item fourth"></div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleInterval" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleInterval" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

Related

Bootstrap Modal messes up Carousel CSS

I have a carousel with modified css because the default font and color of the captions/icons on the images are impossible to see, so I changed the arrows' style and color as well as the caption position/color.
However, when I activate my modal on the page, it resets all of the css applied to the carousel. Why is this happening?
My CSS:
/* CAROUSEL CSS */
.carousel-caption {
position: relative;
left: 0;
right: 0;
}
.carousel-control-prev {
justify-content: start;
}
.carousel-control-next{
justify-content: end;
}
.carousel-control-next-icon {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='red' viewBox='0 0 8 8'%3E%3Cpath d='M2.75 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3E%3C/svg%3E");
}
.carousel-control-prev-icon {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='red' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E");
}
/* for screens smaller then mobile */
#media only screen and (max-width: 600px) {
.carousel-caption {
color: red;
font-size:12px;
}
}
/* for screens bigger then mobile */
#media only screen and (min-width: 600px) {
.carousel-caption {
color: black;
font-size:18px;
}
}
HTML:
<!-- NavBar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Land Power</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home<span class="sr-only"></span></a>
</li>
<!-- <li class="nav-item ">
<a class="nav-link" href="contact.html">Contact Us<span class="sr-only"></span></a>
</li> -->
</ul>
</div>
<div class="d-flex justify-content-end">
<button class="signup btn btn-outline-success my-2 my-sm-0" type="button" linkFile="contact.html" data-toggle="modal" data-remote="contact.html" data-target="#theModal">Sign Up</button>
</div>
</div>
</nav>
<!-- Modal -->
<div class="modal fade" id="theModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
</div>
</div>
</div>
<!-- Carousel -->
<div class="container">
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner ">
<div class="carousel-item active">
<img class="d-block mw-80 mx-auto img-fluid" src="https://placeimg.com/1080/500/arch" alt="First slide">
<div class="carousel-caption bg-secondary ">
<h5>First Slide</h5>
<p>Random Architect Pictures</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block mw-80 mx-auto img-fluid" src="https://placeimg.com/1080/500/nature" alt="Second slide">
<div class="carousel-caption bg-secondary ">
<h5>Second Slide</h5>
<p>Random Nature Pictures</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block mw-80 mx-auto img-fluid" src="https://placeimg.com/1080/500/animals" alt="Third slide">
<div class="carousel-caption bg-secondary ">
<h5>Third Slide</h5>
<p>Random Animal Pictures</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
</a>
</div>
</div>

Bootstrap Carousel - Put next and prev button on top right and closer to each other

Am using bootstrap 4 carousel. Am trying to change the position of next and prev button to be at top right corner but close to each other. I have managed that but i think am making a mistake in my css code since when i minimize the screen I don't see the buttons.
Html code
<div id="featured" class="carousel slide" data-ride="carousel">
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="one.jpg">
</div>
<div class="carousel-item">
<img src="two.jpg" >
</div>
<div class="carousel-item">
<img src="three.jpg" >
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#featured" data-slide="prev">
<span class="fa fa-arrow-circle-left fa-2x" style="color:green"></span>
</a>
<a class="carousel-control-next" href="#featured" data-slide="next">
<span class="fa fa-arrow-circle-right fa-2x" style="color:green"></span>
</a>
</div>
my css code
.carousel-control-prev,
.carousel-control-next{
width:20px;
height: 20px;
background-color: none;
top:calc(-20% -25%);
opacity:.8;
}
.carousel-control-prev{
left:1090px !important;
}
left:1090px !important is going to cause issues once the user's viewport hits close or less than 1090px. In retrospect, you should be able to asses why - because it is pushing it 1090px from left.
Do something like
.carousel-control-prev{
left: unset;
right: 30px;
}
instead, so you can control it from the right since you are positioning it upper-right
$('.carousel').carousel()
.carousel {
background: black;
}
.carousel .carousel-control-prev,
.carousel .carousel-control-next {
width: 20px;
height: 20px;
background-color: none;
top: calc(-20% -25%);
opacity: .8;
}
.carousel .carousel-control-prev {
left: unset;
right: 30px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<div id="featured" class="carousel slide" data-ride="carousel">
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://via.placeholder.com/650x200">
</div>
<div class="carousel-item">
<img src="https://via.placeholder.com/651x200">
</div>
<div class="carousel-item">
<img src="https://via.placeholder.com/652x200">
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#featured" data-slide="prev">
<!--<span class="fa fa-arrow-circle-left fa-2x" style="color:green"></span>-->
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#featured" data-slide="next">
<!--<span class="fa fa-arrow-circle-right fa-2x" style="color:green"></span>-->
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>

Bootstrap 4 CSS Override Not Working Unless Placed in <HEAD>

Following the solution from this SO Question, I put this in my own CSS:
#bootstrap-override .carousel.slide {
max-width: 1920px;
min-width: 900px;
overflow: hidden;
margin-left: auto;
margin-right: auto;
}
#bootstrap-override .carousel-inner {
width: 1920px;
left: 50%;
margin-left: -960px;
}
But... it doesn't work. Bootstrap 4's own CSS wins for some reason. Here's Bootstrap's CSS:
.carousel {
position: relative;
}
.carousel-inner {
position: relative;
width: 100%;
overflow: hidden;
}
.carousel-inner::after {
display: block;
clear: both;
content: "";
}
// the .slide class doesn't appear anywhere (I'm guessing it's just used by the JS, but I don't know that).
My CSS is defined after Bootstrap's, as well:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Condensed&display=swap">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="./css/index.css">
<title>...</title>
</head>
If I place my overriding CSS in the <head> it works correctly (and I get why) but I don't understand why it isn't working when I specify an id+class in my own CSS. As I understand it (which, at this point, must be very wrong) my CSS should have won out over Bootstrap's CSS even without specifying the id. Anybody know what kind of Cascading-Style-Steroids Bootstrap is juicing with?
Edit:
Adding in the relevant HTML, as requested.
<body id="bootstrap-override">
<div id="carousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel" data-slide-to="0" class="active"></li>
<li data-target="#carousel" data-slide-to="1"></li>
<li data-target="#carousel" data-slide-to="2"></li>
</ol>
<a class="carousel-control-prev" href="#carousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<div class="carousel-inner" style="height: 100%;"">
<div class=" carousel-item active">
<img class="d-block" src="./res/image.png" alt="First slide">
<div class="carousel-caption d-none d-md-block">
<table style="margin-left:auto; margin-right:auto;">
<tr>
<td class="align-middle">
<img src="./res/logo.png" alt="...">
</td>
<td class="align-middle">
<h3>...</h3>
</td>
</tr>
</table>
</div>
</div>
<div class="carousel-item">Slide #2...</div>
<div class="carousel-item">Slide #3...</div>
</div>
</div>
</body>
Can you check out the following possibilities -:
Is the following css file linked actually working ?, just try to give body a background color.
If the css class is linked properly then is naming of the classes + id proper?
If proper then sharing a carousal example where I overide Bootstraps carousal css. Hope it is helpful. If this is not helpful please can you help with, little more details like sample html tags of your carousal.
thank you.
JS-fiddle link for reference
Custome CSS
#carouselExampleControls {
height: 100px;
text-align: right;
background: gray;
}
.img-fluid {
max-height: 100px;
}
Html
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<svg class="bd-placeholder-img bd-placeholder-img-lg d-block w-100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false" role="img" aria-label="Placeholder: First slide"><title>Placeholder</title><rect fill="#777"></rect><text x="50%" y="35%" fill="#555" dy=".3em">First slide</text></svg>
</div>
<div class="carousel-item">
<img class="img-fluid" src="https://thumbs.dreamstime.com/b/dead-tree-tall-portrait-view-blue-sky-background-57002950.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="img-fluid" src="https://images.pexels.com/photos/414171/pexels-photo-414171.jpeg" alt="Third slide">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
https://jsfiddle.net/chris495b/e0jzumnc/3/
Hey if you have properly linked your files it should show in the devtools like the screen shot below.can you please share that as well.It would be really helpful in debugging the issue!!

HTML: Change the Bootstrap Carousel Icon from Horizontal Bar to Circle

How do I change the Bootstrap Carousel Slideshow Icons to Circles? Currently they are Horizontal bars.
https://www.w3schools.com/bootstrap/bootstrap_carousel.asp
*Currently this:**
Intended Goal:
Try this code
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style type="text/css">
.carousel-indicators li {
box-sizing: content-box;
-ms-flex: 0 1 auto;
flex: 0 1 auto;
width: 30px;
height: 30px;
line-height: 30px;
border-radius: 50%;
text-align: center;
margin-right: 3px;
margin-left: 3px;
text-indent: unset;
cursor: pointer;
background-color: #fff;
background-clip: unset;
border-top: 0;
border-bottom: 0;
opacity: .5;
transition: opacity .6s ease;
}
</style>
</head>
<body>
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active">1</li>
<li data-target="#carouselExampleIndicators" data-slide-to="1">2</li>
<li data-target="#carouselExampleIndicators" data-slide-to="2">3</li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="https://images.unsplash.com/photo-1489216317223-a88355bd0e38?ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://images.unsplash.com/photo-1474932525110-07bf2cd0de87?ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://images.unsplash.com/photo-1475010040281-9c4f94108f91?ixlib=rb-1.2.1&auto=format&fit=crop&w=624&q=80" alt="Third slide">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>

Is There a way to set height and width of BS4 carousel image according to browsers height and width?

I'm using BS4 full carousel and the pictures I'm putting into it are way large than screen . Their width is ok but the height is large user has to scroll to see the full image kindly tell me a way to reduce the height without affecting the shape and quality of picture ? Please guide on this.
And Tell me that how can I adjust it Dynamically ?
all styling is Default as BS4 . Code is Below:
<div id="carouselFull" class="carousel slide" data-ride="carousel">
<!-- <ol class="carousel-indicators">
<li data-target="#carouselIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselIndicators" data-slide-to="1"></li>
<li data-target="#carouselIndicators" data-slide-to="2"></li>
</ol>
-->
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="img/Home_pics/1.jpg" alt="First slide" id="myImg">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Home_pics/2.jpg" alt="Second slide" id="myImg">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Home_pics/3.jpg" alt="Third slide" id="myImg">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Home_pics/4.jpg" alt="First slide" id="myImg">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Home_pics/5.jpg" alt="Second slide" id="myImg">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Home_pics/6.jpg" alt="Third slide" id="myImg">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Home_pics/7.jpg" alt="First slide" id="myImg">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Home_pics/8.jpg" alt="Second slide" id="myImg">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Home_pics/9.jpg" alt="Third slide" id="myImg">
</div>
</div>
<a class="carousel-control-prev" href="#carouselFull" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselFull" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
You can turn your inline images into background images with a bit of jQuery:
$('#carouselFull').find('.carousel-item').each(function() {
var imgContainer = $(this),
bkImg = imgContainer.find('img').attr('src');
imgContainer.css("background-image", 'url("' + bkImg + '")');
});
#carouselFull {
width: 100%;
}
#carouselFull .carousel-item {
height: 100vh;
width: 100%;
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
.carousel-item img {
display: none;
}
/* Optionally, put the contols closer to the sides */
.carousel-control-next, .carousel-control-prev {
width: 12.5% !important;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<div id="carouselFull" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://i.stack.imgur.com/ZeOrf.jpg" alt="First slide">
</div>
<div class="carousel-item">
<img src="https://i.stack.imgur.com/TICOa.jpg" alt="Second slide">
</div>
</div>
<a class="carousel-control-prev" href="#carouselFull" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselFull" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
All the items you will add to his carousel will be displayed as background images with the right size thanks to background-size: cover.
Use bootstrap's img-fluid class.
<img src="..." class="img-fluid" alt="Responsive image">
https://getbootstrap.com/docs/4.1/content/images/