add link at the bottom of each image in bootstrap carousel - html

How can I add links to the images in the bootstrap carousel? I don't want the links or text over the carousel. I want on the bottom of each picture. I meant after the each picture
<div class="container">
<h1 style="margin-left:483px; margin-bottom:50px;"> Projects </h1>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="images/TekClasses.PNG" alt="Los Angeles" style="width:100%;">
</div>
<div class="item">
<img src="images/sppeder.PNG" alt="Chicago" style="width:100%;">
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<i class="fa fa-chevron-left" style="margin-top:250px;"></i>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<i class="fa fa-chevron-right" style="margin-top:250px;"></i>
<span class="sr-only">Next</span>
</a>
</div>
</div>

With some simple css codes you can do. Check out this https://codepen.io/peshraw-h-ahmed/pen/JvKeME
HTML
<div class="w-25">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="https://via.placeholder.com/350x250" alt="First slide">
<div class="carousel-caption d-none d-md-block">
<h5 class="text-dark">Some example text</h5>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://via.placeholder.com/350x250" alt="Second slide">
<div class="carousel-caption d-none d-md-block">
<h5 class="text-dark">Some example text</h5>
</div>
</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>
CSS
.carousel-caption{
display:block;
position:static;
padding:0;
}

Related

Button on carousel indicator

I have a website that uses bootstrap, I have a issue with carousel indicator the Know more button on the captain not working on most screens specifically a big screen.
My code:
<section class="slider_section">
<div id="myCarousel" class="carousel slide banner-main" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="first-slide" src="images/image1.png" alt="First slide">
<div class="container ">
<div class="carousel-caption relative d-block">
<h1><br><strong class="cur">Person 1</strong></h1>
<p>Admin</p>
<div class="button_section"> <a class="main_bt" href="person1.html">Know More</a></div>
</div>
</div>
</div>
<div class="carousel-item">
<img class="first-slide" src="images/image2.png" alt="First slide">
<div class="container">
<div class="carousel-caption relative d-block">
<h1><br><strong class="cur"> Person 2</strong></h1>
<p> User</p>
<div class="button_section"> <a class="main_bt" href="person2.html">Know More</a></div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel" role="button" data-slide="prev" style="width: 5%;">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#myCarousel" role="button" data-slide="next" style="width: 5%;">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</section>
What is the issue and how do you solve it??

Carousel image size problem with different sized images

In my ecommerce project, I'm creating a carousel but, unfortunately, the size of each image is different. I want all images to fit the same size frame despite their original sizes.
<div id="carouselExampleControls" class="carousel slide w-100 p-3 h-1" data-ride="carousel">
<div class="carousel-inner">
<h1>Hot & Trends</h1>
<hr>
<div class="carousel-item active">
<img src="media/images/1.jpg" class="img-fluid" alt="First Product">
<div class="carousel-caption d-none d-md-block">
<h5>Product Name</h5>
<p>Description</p>
</div>
</div>
<div class="carousel-item">
<img src="media/images/2.jpg" class="img-fluid" alt="Second Product">
<div class="carousel-caption d-none d-md-block">
<h5>Product Name</h5>
<p>Description</p>
</div>
</div>
<div class="carousel-item">
<img src="media/images/3.jpg" class="img-fluid" alt="Third Product">
<div class="carousel-caption d-none d-md-block">
<h5>Product Name</h5>
<p>Description</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>
<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>
<hr>
</div>
select the img and set width and heigh of image 100%
the problem will solve
HTML-Code:
<section id="slider">
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleControls" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleControls" data-slide-to="1"></li>
<li data-target="#carouselExampleControls" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item carousel-image-1 active">
<div class="container">
<div class="carousel-caption text-right mb-5">
<h5 class="display-3">Product Name</h5>
<p class="lead">Description</p>
</div>
</div>
</div>
<div class="carousel-item carousel-image-2">
<div class="container">
<div class="carousel-caption text-right mb-5">
<h5 class="display-3">Product Name</h5>
<p class="lead">Description</p>
</div>
</div>
</div>
<div class="carousel-item carousel-image-3">
<div class="container">
<div class="carousel-caption text-right mb-5">
<h5 class="display-3">Product Name</h5>
<p class="lead">Description</p>
</div>
</div>
</div>
</div>
<a href="#carouselExampleControls" data-slide="prev" class="carousel-control-prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a href="#carouselExampleControls" data-slide="next" class="carousel-control-next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</section>
CSS-Code:
.carousel-item {
height: 450px;
}
.carousel-image-1 {
background: url('../image/image1.jpg');
background-size: cover;
}
This will work fine..
Look like this example. I hope it is as you imagined it. Now you just have to adjust your code like this ...
.carousel {
height: 200px;
}
.carousel-item,
.carousel-inner,
.carousel-inner img {
height: 100%;
width: auto;
}
.carousel-item {
text-align: center;
}
#portfolio {
background: #356;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js" ></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" ></script>
<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">
<section id="portfolio" class="page-section">
<div id="reviews" class="container-fluid">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class='img-fluid' src="https://images.pexels.com/photos/2409628/pexels-photo-2409628.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="...">
<div class="carousel-caption d-md-block">
<h5>Title</h5>
<p>Description</p>
</div>
</div>
<div class="carousel-item">
<img class='img-fluid' src="https://images.unsplash.com/photo-1542141372-98a047557466?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=752&q=80" alt="...">
<div class="carousel-caption d-md-block">
<h5>Title</h5>
<p>Description</p>
</div>
</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>
</div>

Cant make different carousels work properly

In my page, I have multiple games one below the other.
Each game has a distinct carousel.
The problem is that only the first one works as expected.
All the other carousels when the next or previous button is pressed they change the images of the first carousel. They still auto slide though.
I want a way to make each one of the carousels to work distinctly.
I tried to use an i = 0 for the ids to make them work distinctly but that didnt work as expected since none of them worked.
Also, the other issue that I am facing is that when the carousel button is pressed this black background appears carousel-control.
Any thoughts?
index.html.erb
is inside a loop
here is my code
<div id="carouselId" class="carousel slide" data-ride="carousel" style = "width:450px; height: 250px; ">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carouselId" data-slide-to="0" class="active"></li>
<li data-target="#carouselId" data-slide-to="1"></li>
<li data-target="#carouselId" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<%=image_tag "#{#stadio.stadium_name}/1.jpg" %>
</div>
<div class="item">
<%=image_tag "#{#stadio.stadium_name}/2.jpg" %>
</div>
<div class="item">
<%= image_tag "#{#stadio.stadium_name}/3.jpg" %>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#carouselId" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true" ></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carouselId" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true" ></span>
<span class="sr-only">Next</span>
</a>
</div>
<div class="container">
<div class="row" id="row1">
<h1>400x400</h1>
<div class="bd-example">
<div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="1" class=""></li>
<li data-target="#carouselExampleCaptions" data-slide-to="2" class=""></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block img-fluid" src="https://placebear.com/400/400" alt="400x400" />
<div class="carousel-caption d-none d-md-block">
<h3>400x400</h3>
</div>
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="http://www.fillmurray.com/g/400/400" alt="400x400" />
<div class="carousel-caption d-none d-md-block">
<h3>400x400</h3>
</div>
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="https://placekitten.com/g/400/400" alt="400x400" />
<div class="carousel-caption d-none d-md-block">
<h3>400x400</h3>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleCaptions" 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="#carouselExampleCaptions" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
<div class="row" id="row2">
<div class="bd-example">
<h1>600x600</h1>
<div id="carouselExampleCaptions2" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleCaptions2" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleCaptions2" data-slide-to="1" class=""></li>
<li data-target="#carouselExampleCaptions2" data-slide-to="2" class=""></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block img-fluid" src="https://placebear.com/600/600" alt="600x600" />
<div class="carousel-caption d-none d-md-block">
<h3>600x600</h3>
</div>
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="http://www.fillmurray.com/g/600/600" alt="600x600" />
<div class="carousel-caption d-none d-md-block">
<h3>600x600</h3>
</div>
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="https://placekitten.com/g/600/600" alt="600x600" />
<div class="carousel-caption d-none d-md-block">
<h3>600x600</h3>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleCaptions2" 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="#carouselExampleCaptions2" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
<div class="row" id="row3">
<h1>250x250</h1>
<div class="bd-example">
<div id="carouselExampleCaptions3" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleCaptions3" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleCaptions3" data-slide-to="1" class=""></li>
<li data-target="#carouselExampleCaptions3" data-slide-to="2" class=""></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block img-fluid" src="https://placebear.com/250/250" alt="250x250" />
<div class="carousel-caption d-none d-md-block">
<h3>250x250</h3>
</div>
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="http://www.fillmurray.com/g/250/250" alt="250x250" />
<div class="carousel-caption d-none d-md-block">
<h3>250x250</h3>
</div>
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="https://placekitten.com/g/250/250" alt="250x250" />
<div class="carousel-caption d-none d-md-block">
<h3>250x250</h3>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleCaptions3" 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="#carouselExampleCaptions3" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</div>

Bootstrap 4.0 Carousel not working

the bootstrap carousel in bootstrap 4.0 is not working, i have checked everything and written the code 100% the same:
<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/pic03.jpg" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="images/pic01.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="images/pic02.jpg" 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>
The images simply show up below each other and the left and right buttons like links, as if bootstrap isn't even referenced.
.carousel-inner img {
width: 100%;
height: 100%;
}
<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/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<div id="demo" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://www.w3schools.com/bootstrap4/la.jpg" alt="Los Angeles" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/chicago.jpg" alt="Chicago" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/ny.jpg" alt="New York" width="1100" height="500">
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
i have insert here and it's working. you has check jquery and bootstrap js+css?

full width carousel in bootstrap 4 (alpha 6)

<div class="container-fluid" >
<div class="row">
<section class="col-12">
<div class="">
<div class="row">
<section class="col-sm-12">
</div>
<div class="carousel slide" id="featured" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#featured" data-slide-to="0" class="active"></li>
<li data-target="#featured" data-slide-to="1"></li>
<li data-target="#featured" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block img-fluid" src="_images/Slider_1.jpg" alt="slider1">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="_images/Slider_2.jpg" alt="slider2">
<div class="carousel-caption d-none d-md-block">
<h3>Jadon Events</h3>
<p>We organize your events like you cannot even imagine</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="_images/Slider_3.jpg" alt="slider3">
</div>
</div>
<a class="carousel-control-prev" href="#featured" role="button" data-slide="prev"><span class="carousel-control-prev-icon" aria-hidden="true">
<span class="sr-only">Previous</span>
</span></a>
<a class="carousel-control-next" href="#featured" role="button" data-slide="prev"><span class="carousel-control-next-icon" aria-hidden="true">
<span class="sr-only">Next</span>
</span></a>
</div>
</section>
</div>
</div>
I have figured out how to make slider in bootstrap, but now I am stuck with full width slider.
how can I make my carousel full width? I removed container classes but it makes some scroll at bottom which is not good for responsiveness
Try the following code and change images with yours.
<div class="carousel slide" id="featured" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#featured" data-slide-to="0" class="active"></li>
<li data-target="#featured" data-slide-to="1"></li>
<li data-target="#featured" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block img-fluid" src="http://placehold.it/2100x300" alt="slider1">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="http://placehold.it/2100x300" alt="slider2">
<div class="carousel-caption d-none d-md-block">
<h3>Jadon Events</h3>
<p>We organize your events like you cannot even imagine</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="http://placehold.it/2100x300" alt="slider3">
</div>
</div>
<a class="carousel-control-prev" href="#featured" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true">
<span class="sr-only">Previous</span>
</span>
</a>
<a class="carousel-control-next" href="#featured" role="button" data-slide="prev">
<span class="carousel-control-next-icon" aria-hidden="true">
<span class="sr-only">Next</span>
</span>
</a>
</div>