multiple item carousel css bootstrap - html

Just a simple question
I was going through a tutorial for multiple item carousel and found this in I a css code which I couldn't understand
.carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left),
.carousel-inner .carousel-item.active:not(.carousel-item-right):not(.carousel-item-left) + .carousel-item {
transition: none;
}
<div class="container-fluid">
<div id="carouselExample" class="carousel slide" data-ride="carousel" data-interval="900000">
<div class="carousel-inner row w-100 mx-auto" role="listbox">
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2 active">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400/000/fff?text=1" alt="slide 1">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=2" alt="slide 2">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=3" alt="slide 3">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=4" alt="slide 4">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=5" alt="slide 5">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=6" alt="slide 6">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=7" alt="slide 7">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=8" alt="slide 8">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=9" alt="slide 9">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=10" alt="slide 10">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=11" alt="slide 11">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=12" alt="slide 12">
</div>
<div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-2">
<img class="img-fluid mx-auto d-block" src="//placehold.it/600x400?text=13" alt="slide 13">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExample" role="button" data-slide="prev">
<i class="fa fa-chevron-left fa-lg text-muted"></i>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next text-faded" href="#carouselExample" role="button" data-slide="next">
<i class="fa fa-chevron-right fa-lg text-muted"></i>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<br>
<br>
<p class="d-block p-5">
<br>
split up and commented css for understanding. <br>
fixed animation for previous slide. <br>
added breakpoints and slide item counts
<br><br>
based on:
https://www.codeply.com/go/s3I9ivCBYH
</p>
so my question is what is use of classes carousel-item-right and carousel-item-left in above code when it is not even mentioned in the html code?? moreover what these classes are trying to indicate and what they mean??

carousel-item-right and carousel-item-left classes show while a slide is changing. those classes Period of stability is less than 1s. open your browser dev tool to see this. here is a screenshot for you.

Related

Convert a row of images into a carousel in small devices

i'm trying to convert this row of images...
Convert that into a little carousel for visualization in small devices (Responsive Desing) i'm using bootstrap, the code of that images is here:
<div class="row d-flex justify-content-center pb-5" style="background-image: url('assets/img/Vector_Chain1.png'); margin-left:0px; margin-right:0px;">
<img src="assets/img/TheEye.png" class="img-fluid col-md-3 col-sm-8 mt-5 img-section2" alt="">
<img src="assets/img/ThePyramid.png" class="img-fluid col-md-3 col-sm-8 mt-5 img-section2" alt="">
<img src="assets/img/TheEthernal.png" class="img-fluid col-md-3 col-sm-8 mt-5 img-section2" alt="">
</div>
I want when the device are small like a phone, this div convert itself into a carousel for a better visualization
Add classes d-block and d-md-flex to your container
Create a new container for the carousel function on mobile.
Final html code:
<div class="row d-none d-md-flex justify-content-center pb-5" style="background-image: url('assets/img/Vector_Chain1.png'); margin-left:0px; margin-right:0px;">
<img src="assets/img/TheEye.png" class="img-fluid col-md-3 col-sm-8 mt-5 img-section2" alt="">
<img src="assets/img/ThePyramid.png" class="img-fluid col-md-3 col-sm-8 mt-5 img-section2" alt="">
<img src="assets/img/TheEthernal.png" class="img-fluid col-md-3 col-sm-8 mt-5 img-section2" alt="">
</div>
<div id="carouselExampleSlidesOnly" class="carousel slide d-block d-md-none" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="assets/img/TheEye.png" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="assets/img/ThePyramid.png" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="assets/img/ThePyramid.png" alt="Third slide">
</div>
</div>
</div>

How to retain the resizing with Bootstrap 4 as the screen gets smaller with an image that is a link?

I need to get the images in the second container on the right to switch from vertical on the right to horizontal under the first container, and get smaller, as the screen gets smaller. It worked before I added the "< a href..." The link works. What am I doing wrong?
I have tried a few different solutions, including moving col-md-10 col-sm-3 from inside the "< img class="..."" to the "< a href" section and changing img-responsive to img-fluid, but can't seem to get it to resize.
<body>
<div class="jumbotron text-center">
<h1>Lorem Ipsum</h1>
</div>
<div class="row">
<div class="container col-lg-7">
<div class="col-md-12 pull-right">
<h1>Summary: Lorem Ipsum<hr/></h1>
<img data-src="holder.js/200x200" class="img-responsive shadow float-left col-md-4" alt="200x200" src="Lorem Ipsum.png" data-holder-rendered="true">
<p class="text-left lead">Lorem Ipsum<br><br>
Lorem Ipsum</p>
</div>
</div>
<div class="container col-lg-3">
<div class="col-md-12">
<h1 class="text-center">Lorem Ipsum<hr/></h1>
<a class= "col-md-10 col-sm-3" href="Lorem Ipsum.html">
<img data-src="holder.js/200x200" class="img-responsive mx-auto d-block shadow" alt="200x200" src="Lorem Ipsum.png" data-holder-rendered="true">
</a>
<a class= "col-md-10 col-sm-3" href="Lorem Ipsum.html">
<img data-src="holder.js/200x200" class="img-responsive mx-auto d-block shadow" alt="200x200" src="Lorem Ipsum.png"data-holder-rendered="true">
</a>
<a class= "col-md-10 col-sm-3" href="Lorem Ipsum.html">
<img data-src="holder.js/200x200" class="img-responsive mx-auto d-block shadow" alt="200x200" src="Lorem Ipsum.png"data-holder-rendered="true">
</a>
<a class= "col-md-10 col-sm-3" href="Lorem Ipsum.html">
<img data-src="holder.js/200x200" class="img-responsive mx-auto d-block shadow" alt="200x200" src="Lorem Ipsum.png" data-holder-rendered="true">
</a>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<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>
</body>
If you are using Bootstrap 4, you should definitely use img-fluid to get the images to resize, see the bootstrap docs
In order to make your images align horizontally when using an sm-screen, you should put them in an element with display: flex. Just using the d-flex class causes problems with wrapping on larger screens, so row seems to be your best option:
<div class="container col-lg-3">
<div class="col-md-12">
<h1 class="text-center">Lorem Ipsum<hr/></h1>
<div class="row">
<a class= "col-md-10 col-sm-3" href="Lorem Ipsum.html">
<img data-src="holder.js/200x200" class="img-fluid mx-auto d-block shadow" alt="200x200" src="https://upload.wikimedia.org/wikipedia/commons/1/1b/Square_200x200.png" data-holder-rendered="true">
</a>
<a class= "col-md-10 col-sm-3" href="Lorem Ipsum.html">
<img data-src="holder.js/200x200" class="img-fluid mx-auto d-block shadow" alt="200x200" src="https://upload.wikimedia.org/wikipedia/commons/1/1b/Square_200x200.png"data-holder-rendered="true">
</a>
<a class= "col-md-10 col-sm-3" href="Lorem Ipsum.html">
<img data-src="holder.js/200x200" class="img-fluid mx-auto d-block shadow" alt="200x200" src="https://upload.wikimedia.org/wikipedia/commons/1/1b/Square_200x200.png"data-holder-rendered="true">
</a>
<a class= "col-md-10 col-sm-3" href="Lorem Ipsum.html">
<img data-src="holder.js/200x200" class="img-fluid mx-auto d-block shadow" alt="200x200" src="https://upload.wikimedia.org/wikipedia/commons/1/1b/Square_200x200.png" data-holder-rendered="true">
</a>
</div>
</div>
</div>
I have made a fiddle to show this working.
I figured it out. The answer was to put each image and link into a separate container and add col-3 for the extra small page size.
<div class="row">
<div class="container col-md-10 col-sm-3 col-3">
<a href="Lorem.html">
<img data-src="holder.js/200x200" class="img-fluid mx-auto d-block shadow" alt="200x200" src="Lorems.png" data-holder-rendered="true">
</a>
</div>
<div class="container col-md-10 col-sm-3 col-3">
<a href="Lorem.html">
<img data-src="holder.js/200x200" class="img-fluid mx-auto d-block shadow" alt="200x200" src="Lorems.png"data-holder-rendered="true">
</a>
</div>
<div class="container col-md-10 col-sm-3 col-3">
<a href="Lorem.html">
<img data-src="holder.js/200x200" class="img-fluid mx-auto d-block shadow" alt="200x200" src="Lorems.png"data-holder-rendered="true">
</a>
</div>
<div class="container col-md-10 col-sm-3 col-3">
<a href="Lorem.html">
<img data-src="holder.js/200x200" class="img-fluid mx-auto d-block shadow" alt="200x200" src="Lorems.png" data-holder-rendered="true">
</a>
</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/

Align text and image on the same line on a list group

Hello everyone so i'm making a website as a project and in one of the parts i'm putting a list group with the name of the item and on the right the image of said item. I did it already using Pingendo but the text is not align with the image correctly.
This is the code i have atm:
<div class="container">
<div class="row">
<div class="col-sm-2"> </div>
<div class="col-sm-8">
<!-- Page Content -->
<div class="container">
<div class="row text-center text-lg-left">
<div class="col-md-12">
<div class="list-group my-3">
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="w-100">
<h4 class="mb-1 text-center">Arduino Uno</h4>
</div>
<img class="d-block float-right img-thumbnail img-fluid" src="https://pingendo.com/assets/photos/wireframe/photo-1.jpg" width="150" height="150" > </a>
</a>
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="w-100">
<h5 class="mb-1 text-center">Breadboard</h5>
</div>
<img class="d-block float-right img-thumbnail img-fluid" src="https://pingendo.com/assets/photos/wireframe/photo-1.jpg" width="60" height="60" > </a>
</a>
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="w-100">
<h5 class="mb-1 text-center">Product</h5>
</div>
<img class="d-block float-right img-thumbnail img-fluid" src="https://pingendo.com/assets/photos/wireframe/photo-1.jpg" width="60" height="60" > </a>
</a>
</div>
and this is how it looks on the website:
Basically what i'm trying to do is to put both text and image aligned on the same line so i doesn't look the text on the top and the image below.
Thanks in advance.
Remove '.flex-column' class form .list-group-item and add '.d-flex'.
also remove duplicate closing a tag form your code
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col-sm-2"> </div>
<div class="col-sm-8">
<!-- Page Content -->
<div class="container">
<div class="row text-center text-lg-left">
<div class="col-md-12">
<div class="list-group my-3">
<a href="#" class="list-group-item list-group-item-action d-flex align-items-start">
<div class="w-100">
<h4 class="mb-1 text-center">Arduino Uno</h4>
</div>
<img class="d-block float-right img-thumbnail img-fluid" src="https://pingendo.com/assets/photos/wireframe/photo-1.jpg" width="60" height="60" > </a>
<a href="#" class="list-group-item list-group-item-action d-flex align-items-start">
<div class="w-100">
<h5 class="mb-1 text-center">Breadboard</h5>
</div>
<img class="d-block float-right img-thumbnail img-fluid" src="https://pingendo.com/assets/photos/wireframe/photo-1.jpg" width="60" height="60" > </a>
<a href="#" class="list-group-item list-group-item-action d-flex align-items-start">
<div class="w-100">
<h5 class="mb-1 text-center">Product</h5>
</div>
<img class="d-block float-right img-thumbnail img-fluid" src="https://pingendo.com/assets/photos/wireframe/photo-1.jpg" width="60" height="60" > </a>
</div>
if you want text and image into center
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col-sm-2"> </div>
<div class="col-sm-8">
<!-- Page Content -->
<div class="container">
<div class="row text-center text-lg-left">
<div class="col-md-12">
<div class="list-group my-3">
<a href="#" class="list-group-item list-group-item-action d-flex align-items-center">
<div class="w-100">
<h4 class="mb-0 text-center">Arduino Uno</h4>
</div>
<img class="d-block float-right img-thumbnail img-fluid" src="https://pingendo.com/assets/photos/wireframe/photo-1.jpg" width="60" height="60" > </a>
<a href="#" class="list-group-item list-group-item-action d-flex align-items-center">
<div class="w-100">
<h5 class="mb-0 text-center">Breadboard</h5>
</div>
<img class="d-block float-right img-thumbnail img-fluid" src="https://pingendo.com/assets/photos/wireframe/photo-1.jpg" width="60" height="60" > </a>
<a href="#" class="list-group-item list-group-item-action d-flex align-items-center">
<div class="w-100">
<h5 class="mb-0 text-center">Product</h5>
</div>
<img class="d-block float-right img-thumbnail img-fluid" src="https://pingendo.com/assets/photos/wireframe/photo-1.jpg" width="60" height="60" > </a>
</div>

Images in Bootstrap Grid [duplicate]

This question already has answers here:
`col-xs-*` not working in Bootstrap 4
(6 answers)
No img-responsive in Bootstrap 4
(7 answers)
Missing col-xs sizes using bootstrap 4 [duplicate]
(1 answer)
Closed 5 years ago.
I'm trying to display images in a container, but i have a problem when resizing the browser window: Before going from 6 to 4 items, it stays at 6 items per row, but now they overlap
Here is what i'm talking about: https://www.bootply.com/render/dKyKQWIL9j
The images have to stay a fixed size (160x230) and there should always be a margin of 7 at top/bottom and some margin inbetween the items in a row (just not a margin on the outer left and right, so the images allign perfectly in the container)
Here is my code:
<div class="container" style="border:1px solid green">
<div class="row">
<div class="col-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:7px;margin-bottom:7px;border:1px solid red">
<a href="#" class="d-block mb-6">
<img class="rounded img-fluid" src="http://via.placeholder.com/160x230.jpg" width="160" height="230">
</a>
</div>
<div class="col-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:7px;margin-bottom:7px;border:1px solid red">
<a href="#" class="d-block mb-6">
<img class="rounded img-fluid" src="http://via.placeholder.com/160x230.jpg" width="160" height="230">
</a>
</div>
<div class="col-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:7px;margin-bottom:7px;border:1px solid red">
<a href="#" class="d-block mb-6">
<img class="rounded img-fluid" src="http://via.placeholder.com/160x230.jpg" width="160" height="230">
</a>
</div>
<div class="col-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:7px;margin-bottom:7px;border:1px solid red">
<a href="#" class="d-block mb-6">
<img class="rounded img-fluid" src="http://via.placeholder.com/160x230.jpg" width="160" height="230">
</a>
</div>
<div class="col-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:7px;margin-bottom:7px;border:1px solid red">
<a href="#" class="d-block mb-6">
<img class="rounded img-fluid" src="http://via.placeholder.com/160x230.jpg" width="160" height="230">
</a>
</div>
<div class="col-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:7px;margin-bottom:7px;border:1px solid red">
<a href="#" class="d-block mb-6">
<img class="rounded img-fluid" src="http://via.placeholder.com/160x230.jpg" width="160" height="230">
</a>
</div>
<div class="col-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:7px;margin-bottom:7px;border:1px solid red">
<a href="#" class="d-block mb-6">
<img class="rounded img-fluid" src="http://via.placeholder.com/160x230.jpg" width="160" height="230">
</a>
</div>
<div class="col-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:7px;margin-bottom:7px;border:1px solid red">
<a href="#" class="d-block mb-6">
<img class="rounded img-fluid" src="http://via.placeholder.com/160x230.jpg" width="160" height="230">
</a>
</div>
<!-- etc... -->
</div>
</div>
(The solid borders are just there for testing)
Any help is greatly appreciated. I'm kind of new to css and html, but i did my best reading the bootstrap documentation of their grid system, but i couldn't find anything in between col-6 col-sm-4 col-md-3 col-lg-2 to fix my problem. Thanks in advance!
Edit:
When resizing the browser window the images should always stay the same resolution and go from 6 items in a row down to 2 items per row (so 6-5-4-3-2), while always filling the screen as soon as the browser size is smaller than the container.
I see you are using bootstrap version 4, So please use col-6 instead of col-xs-6 for mobile. And also for responsive images use img-fluid instead of img-responsive class. Thanks