How to increase image size using Carousel in bootstrap 4? - html

How can I increase the image size as the photo? I have tried adding css code to increase the size but it increases the size to the right and overlaps the text on the right. I need the image to increase to the left
<div class="container">
<div class="row">
<div class="col-md-6">
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active"> <img class="d-block w-100" src="Images/RakirakiSlide/slide1.jpg" alt="First slide"> </div>
<div class="carousel-item"> <img class="d-block w-100" src="Images/RakirakiSlide/slide2.jpg" alt="Second slide"> </div>
<div class="carousel-item"> <img class="d-block w-100" src="Images/RakirakiSlide/slide3.jpg" alt="Second slide"> </div>
<div class="carousel-item"> <img class="d-block w-100" src="Images/RakirakiSlide/slide4.jpg" alt="Second slide"> </div>
<div class="carousel-item"> <img class="d-block w-100" src="Images/RakirakiSlide/slide5.jpg" alt="Second 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>
</div>

add this css code:
#carouselExampleControls .carousel-item img {
width: 100%;
}

Related

Adding image logo to bootstrap carousel

As I try to add a logo image to the carousel, I have a hard time making sure the logo remains stationary at all times without moving inside the carousel.
<!--logo-->
<div class="logo-image">
<img src="Aaron%20Murillo-Black.png" class="img-fluid">
</div>
<!--Carousel image slider-->
<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="logo-image">
<img src="Aaron%20Murillo-Black.png" class="img-fluid" alt="Web Site Logo">
</div>
<div class="carousel-item active">
<img src="Dress.jpg" class="d-block w-100" alt="Dress">
</div>
<div class="carousel-item">
<img src="Balloon.jpg" class="d-block w-100" alt="Balloon Fiesta">
</div>
<div class="carousel-item">
<img src="DarkChurch.jpg" class="d-block w-100" alt="Dark Church">
</div>
<div class="carousel-item">
<img src="River%20Falls.jpg" class="d-block w-100" alt="River Cave">
</div>
<div class="carousel-item">
<img src="Wedding.jpg" class="d-block w-100" alt="Couples">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" 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="#carouselExampleControls" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
all my css with this had been a bust.
.logo-image{
width: 10%;
height: 100px;
border-radius: 10%;
overflow: hidden;
margin: auto;
position: relative;
}
Well, if I'm not getting you wrong you want to make the logo stationary and not moving as the carousel moves ?
You could do this in the CSS, by:
Giving the carousel a position of relative and the logo that of absolute
Wrap all your code with div and make it relative then make .logo-image absolute, it will make your logo remain still
.wrap {
position: relative;
}
.logo-image {
position: absolute;
top: 0;
left: 0;
}
<div class="wrap">
<!--logo-->
<div class="logo-image">
<img src="Aaron%20Murillo-Black.png" class="img-fluid">
</div>
<!--Carousel image slider-->
<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="logo-image">
<img src="Aaron%20Murillo-Black.png" class="img-fluid" alt="Web Site Logo">
</div>
<div class="carousel-item active">
<img src="Dress.jpg" class="d-block w-100" alt="Dress">
</div>
<div class="carousel-item">
<img src="Balloon.jpg" class="d-block w-100" alt="Balloon Fiesta">
</div>
<div class="carousel-item">
<img src="DarkChurch.jpg" class="d-block w-100" alt="Dark Church">
</div>
<div class="carousel-item">
<img src="River%20Falls.jpg" class="d-block w-100" alt="River Cave">
</div>
<div class="carousel-item">
<img src="Wedding.jpg" class="d-block w-100" alt="Couples">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" 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="#carouselExampleControls" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</div>

Bootstrap 5 Carousel Mask Effect

I try to apply the masking effect for Carousel images at bootstrap 5 in the Django web project.
I tried many solutions but nothing work
this is the carousel
<div id="carouselExampleControls" class="carousel slide carousel-fade" data-bs-ride="carousel">
<div class="carousel-inner" >
<div class="carousel-item active" data-bs-interval="10000">
<img src="{% static '.\images\home\sec1-1.jpg' %}" class="d-block w-100" alt="..." >
<div class="carousel-caption d-none d-md-block ">
<h1>Welcome to Markvira Agency</h1>
<p>Smart digital marketing agency</p>
</div>
</div>
<div class="carousel-item" data-bs-interval="2000">
<img src="{% static '.\images\home\sec1-2.jpg' %}" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h1>Welcome to Markvira Agency</h1>
<p>Smart digital marketing agency</p>
</div>
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" 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="#carouselExampleControls" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
i tried the mask tag like this..but effect appear only at text are not mask the whole image slide
<div class="carousel-item active" data-bs-interval="10000">
<img src="{% static '.\images\home\sec1-1.jpg' %}" class="d-block w-100" alt="..." >
<div class="mask" style="background-color: rgba(0, 0, 0, 0.6)"> <!--Mask Tag-->
<div class="carousel-caption d-none d-md-block ">
<h1>Welcome to Markvira Agency</h1>
<p>Smart digital marketing agency</p>
</div>
</div>
I want to make a gray layer over carousel images
like this
I hope you could help me
Thanks

How to add padding around a carousel

So I added a carousel to my home page and it takes up the entire page and doesn't look good. I want to add some padding on all four sides, and I tried by using <div padding:25px> </div> but it doesn't work.
<div padding:25px>
<div id="carouselExampleFade" class="carousel slide carousel-fade" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="...">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleFade" 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="#carouselExampleFade" data-bs-
slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</div>
Just add to the top :
<div style='padding:25px'>
It should work.
That is not how inline styles work.
You need to put the styles inside the style attribute like so:
<div style="padding: 25px;"></div>
By the way, inline styles are not recommended. You might want to put the styles in an external stylesheet and link that stylesheet with your HTML file.
Thank you.
Just wrap your code into a grid column and you're good to go.
<div class="col-12 col-md-10 col-xl-8 offset-xl-2 offset-md-1">
<div
id="carouselExampleFade"
class="carousel slide carousel-fade"
data-bs-ride="carousel"
>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="..." class="d-block w-100" alt="..." />
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="..." />
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="..." />
</div>
</div>
<button
class="carousel-control-prev"
type="button"
data-bs-target="#carouselExampleFade"
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="#carouselExampleFade"
data-bs-
slide="next"
>
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</div>

Split bootstrap's carousel slide in multiple slides next to each other and change visibility of arrows

I would like to do a carousel in bootstrap which is split into 187x300 slides but the slides to stay some sort of next each other with a little space between them.
Also, I have resized the carousel to the size of the slide but the only visible arrow is the left one and it's on the slide itself.
I would like it to be outside of it of some sort like to the left but outside of the slide (same for the right side).
I will attach an image as for example.
Also (I know I am repeating myself), if it's not too heavy for this question I would like it to do it like some sort of a Netflix carousel so on hover of the slide the image becomes a tiny bit bigger and it has a black overlay with text over the overlay. Thank you.
Code :
index.html
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Na merge</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="css/test.css">
</head>
<body>
<div class="carousel slide carousel-fade" data-ride="carousel">
<!--Slides-->
<div class="carousel-inner" role="listbox">
<!--First slide-->
<div class="carousel-item active">
<img class="d-block w-100" src="https://via.placeholder.com/187x300"
alt="First slide">
</div>
<!--/First slide-->
<!--Second slide-->
<div class="carousel-item">
<img class="d-block w-100" src="https://via.placeholder.com/187x300"
alt="Second slide">
</div>
<!--/Second slide-->
<!--Third slide-->
<div class="carousel-item">
<img class="d-block w-100" src="https://via.placeholder.com/187x300"
alt="Third slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://via.placeholder.com/187x300"
alt="Third slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://via.placeholder.com/187x300"
alt="Fourth slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://via.placeholder.com/187x300"
alt="Fifth slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://via.placeholder.com/187x300"
alt="Sixth slide">
</div>
<!--/Third slide-->
</div>
<!--/.Slides-->
<!--Controls-->
<a class="carousel-control-prev" href="#fullCarousel" 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="#fullCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<!--/.Controls-->
</div>
<!--/.Carousel Wrapper-->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>
</html>
style.css
.carousel-item{
height: 300px;
width: 187px;
}
.carousel-item img{
height: 300px;
width: 187px;
}
Please remove this style :
.carousel-item{
height: 300px;
width: 187px;
}
Then add your items into one item like this :
<div class="carousel-item">
<div class="row">
<div class="col-sm">
<img src"...">
</div>
<div class="col-sm">
<img src="...">
</div>
<div class="col-sm">
<img src="...">
</div>
<div class="col-sm">
<img src="...">
</div>
</div>
</div>

how do i lock a row in bootstrap 4?

I just created a slider that holds four images, the issue is, as soon as the pixel size dips below < 768px, the images begin to lose quality and then stack. Is there any possible way I can lock the images on one row so that they don't move after it goes below 768px?
Thanks in advance.
<div class="container">
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" role="listbox">
<!-- slider 1 -->
<div class="carousel-item active">
<div class="row">
<div class="col-md-3 col-sm-3 col-xs-3">
<span><img class="d-block img-thumbnail img-fluid" src="images/5.jpg" alt="First slide"> </span>
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<span><img class="d-block img-thumbnail img-fluid" src="images/5.jpg" alt="First slide"> </span>
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<span><img class="d-block img-thumbnail img-fluid" src="images/5.jpg" alt="First slide"> </span>
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<span><img class="d-block img-thumbnail img-fluid" src="images/5.jpg" alt="First slide"> </span>
</div>
</div>
</div>
<!-- slider 2 -->
<div class="carousel-item">
<div class="row">
<div class="col-md-3 col-sm-3 col-xs-3">
<span><img class="d-block img-thumbnail img-fluid" src="images/5.jpg" alt="First slide"> </span>
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<span><img class="d-block img-thumbnail img-fluid" src="images/5.jpg" alt="First slide"> </span>
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<span><img class="d-block img-thumbnail img-fluid" src="images/5.jpg" alt="First slide"> </span>
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<span><img class="d-block img-thumbnail img-fluid" src="images/5.jpg" alt="First slide"> </span>
</div>
</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>
<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>
</div>
css:
.carousel-item span img {
height:200px !important;
}
For Bootstrap 4, you have a new col- tag
So you need to use col-3 in place of specifying col-xs-3 for your divs
(Note that specifying col- automatically sets sm, xs, lg to the same widths unless you specify another class for sm/xs/lg)
jsfiddle: https://jsfiddle.net/as6md81b/16/
Refer https://getbootstrap.com/docs/4.0/layout/grid/