Bootstrap 4.1.1 CSS carousel slider arrows alignment - css

How can i arrange the carousel control arrows from left and right end of screen in Bootstrap 4.1.1?
I tried following code but didn't work.
.carousel-control .icon-prev{
left: 5px
}
.carousel-control .icon-next{
right: 5px
}
This is my HTML code for the carousal.
<div id="slider3" class="carousel slide mb-5 carousel-fade" data-ride="carousel">
<ol class="carousel-indicators">
<li class="active" data-target="#slider3" data-slide-to="0"></li>
<li data-target="#slider3" data-slide-to="1"></li>
<li data-target="#slider3" data-slide-to="2"></li>
<li data-target="#slider3" data-slide-to="3"></li>
<li data-target="#slider3" data-slide-to="4"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block img-fluid" src="img/car1.jpg" alt="First Slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="img/car2.jpg" alt="Second Slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="img/car3.jpg" alt="Third Slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="img/car2.jpg" alt="Fourth Slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="img/car3.jpg" alt="Fifth Slide">
</div>
</div>
<!-- CONTROLS -->
<a href="#slider3" class="carousel-control-prev" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a href="#slider3" class="carousel-control-next" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>

Try with following code, your current approach is also not bad but expensive indeed:
.carousel-control-next,
.carousel-control-prev {
width:20px;
}
Explanation: You trying adjust inside element of next prev buttons. But button is icon container which had flex with align-items:center, that's why it is not applying your .carousel-control .icon-prev positions.

Related

bootstrap carousel not aligning items correctly

I am relatively new to css and bootstrap and I'm trying to implement a carousel into my angular web app. I copied the source code from the bootstrap site but am having a lot of difficulties aligning everything correctly. Also the image slides don't seem to be working as well - when I click on the prev or next arrow the page reloads and it goes to /#carouselExampleIndicators.
<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>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="img fluid" src="../../assets/img/actual.png" alt="First slide" width="300" height="300">
<div class="carousel-caption d-none d-md-block">
<h5>text 1</h5>
<p>...</p>
</div>
</div>
<div class="carousel-item">
<img class="img fluid" src="../../assets/img/image0.jpeg" alt="Second slide">
<div class="carousel-caption d-none d-md-block">
<h5>text 2</h5>
<p>...</p>
</div>
</div>
<div class="carousel-item">
<img class="img fluid" src="../../assets/img/Picture1.png" alt="Third slide">
<div class="carousel-caption d-none d-md-block">
<h5>text 3</h5>
<p>...</p>
</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>
Any styling/function advice would be appreciated - thanks!!
It's a pretty easy fix! You have a few options. The class for an '''img-fluid''' has the dash - it's not separate. See below. Add it to each image. For the href, just do the same thing you did on the first image - src="" is where you put that photo address.
<img class="img-fluid" src="../../yourimage.jpg" />
Once you do that, your image will take up the entire page. I would recommending doing the following to the top of the carousel:
<div id="carouselExampleIndicators" class="carousel slide container" data-ride="carousel">
Add the class container to contain your image.
With that, the carousel looks great!
I'm not sure exactly how you are trying to build your site, but you could also play around with bootstrap column sizing (ie col-md-8 col-lg-6). Let me know if this is the help you were looking for, and I'm happy to clarify. Have a great day.

Carousel Bootstrap 4

background-image: linear-gradient(to top, black 0%, transparent 100%);
How to add this gradient to bootstrap 4 carousel?
I tried to put it in carousel-item and carousel-inner. No affect.
This is how looks my bs4 carousel
<div id="gallery" class="carousel slide" data-ride="carousel" style="margin-top: 6rem;">
<ol class="carousel-indicators">
<li data-target="#gallery" data-slide-to="0" class="active"></li>
<li data-target="#gallery" data-slide-to="1"></li>
<li data-target="#gallery" data-slide-to="2"></li>
<li data-target="#gallery" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="img/gallery1.jpg" class="d-block w-100 gallery-img" alt="ВИГВАМ">
<div class="carousel-caption">
<h5>item0</h5>
<p>desc</p>
</div>
</div>
<div class="carousel-item">
<img src="img/gallery8.jpg" class="d-block w-100 gallery-img" alt="item">
<div class="carousel-caption">
<h5>item1</h5>
<p>desc</p>
</div>
</div>
<div class="carousel-item">
<img src="img/gallery2.jpg" class="d-block w-100 gallery-img" alt="item">
<div class="carousel-caption">
<h5>item2</h5>
<p>desc</p>
</div>
</div>
<div class="carousel-item">
<img src="img/gallery3.jpg" class="d-block w-100 gallery-img" alt="item">
<div class="carousel-caption">
<h5>item3</h5>
<p>desc</p>
</div>
</div>
<a class="carousel-control-prev" href="#gallery" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">prev</span>
</a>
<a class="carousel-control-next" href="#gallery" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">next</span>
</a>
</div>
</div>
.carousel::after {
background-image: linear-gradient(to top, black 0%, transparent 100%);
bottom: 0;
content: "";
height: 100px;
left: 0;
position: absolute;
right: 0;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<div id="gallery" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#gallery" data-slide-to="0" class="active"></li>
<li data-target="#gallery" data-slide-to="1"></li>
<li data-target="#gallery" data-slide-to="2"></li>
<li data-target="#gallery" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://www.chancerides.com/wp-content/uploads/2017/03/cr_detail_36ft_carrousel.jpg" class="d-block w-100 gallery-img" alt="ВИГВАМ">
<div class="carousel-caption">
<h5>item0</h5>
<p>desc</p>
</div>
</div>
<div class="carousel-item">
<img src="https://www.chancerides.com/wp-content/uploads/2017/03/cr_detail_36ftdd_carrousel.jpg" class="d-block w-100 gallery-img" alt="item">
<div class="carousel-caption">
<h5>item1</h5>
<p>desc</p>
</div>
</div>
<div class="carousel-item">
<img src="https://www.guernseys.com/v2/images/Carousel/700x400_1.jpg" class="d-block w-100 gallery-img" alt="item">
<div class="carousel-caption">
<h5>item2</h5>
<p>desc</p>
</div>
</div>
<div class="carousel-item">
<img src="https://www.chancerides.com/wp-content/uploads/2017/09/carrousel_gallery_2.jpg" class="d-block w-100 gallery-img" alt="item">
<div class="carousel-caption">
<h5>item3</h5>
<p>desc</p>
</div>
</div>
<a class="carousel-control-prev" href="#gallery" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">prev</span>
</a>
<a class="carousel-control-next" href="#gallery" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">next</span>
</a>
</div>
</div>

bootstrap 4 multiple elements previous collapse

I added the bootstrap carousel and changed to display multiple items, although I have a problems
When I click on the next logo everything is ok, but when I click on the previous logo, appear multiple logos all together before to fix itself, What happens? How can I fix that problem?
Here a link to the project, live page and complete repo
https://sebalaini.github.io/portfolio_test/
https://github.com/sebalaini/portfolio_test
Here the Codepen https://codepen.io/sebalaini/pen/wpRVYL and the code:
<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="4"></li>
<li data-target="#carousel" data-slide-to="8"></li>
<li data-target="#carousel" data-slide-to="10"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="First slide">
<div class="carousel-caption d-block">
<h4>HTML</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="Second slide">
<div class="carousel-caption d-block">
<h4>CSS</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="Third slide">
<div class="carousel-caption d-block">
<h4>SASS</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="Third slide">
<div class="carousel-caption d-block">
<h4>Javascript</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="First slide">
<div class="carousel-caption d-block">
<h4>Jquery</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="Second slide">
<div class="carousel-caption d-block">
<h4>React</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="First slide">
<div class="carousel-caption d-block">
<h4>webpack</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="Third slide">
<div class="carousel-caption d-block">
<h4>NPM</h4>
</div>
</div>
</div>
<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>
It seems that the numbering of your indicators was a bit messed up. Also, you have a bit much of custom css for my taste. So, I ripped it out and used native Bootstrap classes instead such as mx-auto (margin horizontal auto).
Check out this snippet and then start adding your own custom code bit by bit until you see where it breaks:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<style>
body {
background: black;
}
.carousel-inner {
height: 300px;
}
.carousel-item {
height: 300px;
}
.carousel-item img {
max-width: 250px;
max-height: 250px;
}
</style>
<div class="container">
<div class="row">
<div class="col mt-4">
<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="3"></li>
<li data-target="#carousel" data-slide-to="7"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block mx-auto" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="First slide">
<div class="carousel-caption d-block mx-auto">
<h4>01 HTML</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block mx-auto" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="Second slide">
<div class="carousel-caption d-block mx-auto">
<h4>02 CSS</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block mx-auto" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="Third slide">
<div class="carousel-caption d-block mx-auto">
<h4>03 SASS</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block mx-auto" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="Third slide">
<div class="carousel-caption d-block mx-auto">
<h4>04 Javascript</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block mx-auto" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="First slide">
<div class="carousel-caption d-block mx-auto">
<h4>05 Jquery</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block mx-auto" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="Second slide">
<div class="carousel-caption d-block mx-auto">
<h4>06 React</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block mx-auto" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="First slide">
<div class="carousel-caption d-block mx-auto">
<h4>07 webpack</h4>
</div>
</div>
<div class="carousel-item">
<img class="d-block mx-auto" src="https://wallpapercave.com/wp/ci1BoK6.jpg" alt="Third slide">
<div class="carousel-caption d-block mx-auto">
<h4>08 NPM</h4>
</div>
</div>
</div>
<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>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

Remove carousel sliding in one page

I am using bootstrap and I want to use the carousel in one page without sliding.
I've seen this effect can be removed by setting interval to false. The problem is that I want to have a sliding carousel in my home page but not in the rest. So changing this value is not a valid solution for me.
How can I solve this???
I've found that when we add data-interval="false" it stops sliding:
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
<!-- 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>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<div class="navigationBarImg">
<img src="/Images/Pictures/1254_1.jpg" class="image-responsive" alt="First slide">
</div>
<div class="container"></div>
</div>
<div class="item">
<div class="navigationBarImg">
<img src="/Images/Pictures/1308_1.jpg" class="image-responsive" alt="Second slide">
</div>
<div class="container"></div>
</div>
<div class="item">
<div class="navigationBarImg">
<img src="/Images/Pictures/1375_1.jpg" class="image-responsive" alt="Third slide">
</div>
<div class="container"></div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div><!-- /.carousel -->

Bootstrap on slide show panel

Please i wanna help in my slideshow>>>
My problem is: i want to put a panel on the slide show,, but when i tried to give that panel (- margin) the slideshow goes to right and made a scroll in the page!!
That't my code
<div class="room-booking">
<div class="container">
<div class="col-lg-2">
<div class="room-booking">
<p style="color:#f8c45a; padding:20px 30px; margin:0px;">1/4</p>
</div> <!-- End room-booking -->
</div> <!-- End col-lg-4 -->
</div> <!-- End Container -->
</div>
<!-- Carousel -->
<div data-ride="carousel" class="carousel slide" id="carousel-example-generic" style="z-index:0">
<ol class="carousel-indicators">
<li data-slide-to="0" data-target="#carousel-example-generic" class="custom-indicators" ></li>
<li data-slide-to="1" data-target="#carousel-example-generic" class="custom-indicators"></li>
<li data-slide-to="2" data-target="#carousel-example-generic" class="custom-indicators active"></li>
<li data-slide-to="3" data-target="#carousel-example-generic" class="custom-indicators"></li>
</ol>
<div class="carousel-inner">
<div class="item">
<img class="img-responsive" alt="First slide" data-src="holder.js/900x500/auto/#777:#555/text:First slide" src="img/pic1.png" style="margin-left:auto; margin-right:auto; width:100%; height:636px;">
</div>
<div class="item">
<img class="img-responsive" alt="Second slide" data-src="holder.js/900x500/auto/#666:#444/text:Second slide" src="img/pic1.png" style="margin-left:auto; margin-right:auto; width:100%; height:636px;">
</div>
<div class="item active">
<img class="img-responsive" alt="Third slide" data-src="holder.js/900x500/auto/#555:#333/text:Third slide" src="img/pic1.png" style="margin-left:auto; margin-right:auto; width:100%; height:636px;">
</div>
<div class="item">
<img class="img-responsive" class="img-responsive" alt="Forth slide" data-src="holder.js/900x500/auto/#666:#444/text:Forth slide" src="img/pic1.png" style="margin-left:auto; margin-right:auto; width:100%; height:636px;">
</div>
</div>
<a data-slide="prev" href="#carousel-example-generic" class="left-arrow">
<div class="halfCircleLeft"><span style="padding:15px 0px 0px 5px;" class="glyphicon glyphicon-chevron-left"></span></div>
</a>
<a data-slide="next" href="#carousel-example-generic" class="right-arrow">
<div class="halfCircleRight"><span style="padding:15px 0px 0px 0px;" class="glyphicon glyphicon-chevron-right"></span></div>
</a>
</div>
<!-- END Carousel -->
Something like this >>
http://postimg.org/image/k7c5hl7yx/
What you are trying to add is called a caption. Try the following on each slide you want to add to:
<div class="item active">
<img src="..." alt="...">
<div class="carousel-caption">
<h3>...</h3>
<p>...</p>
</div>
</div>

Resources