Bootstrap 4 Carousel - Text Left / Image Right - html

I'm trying to figure if this design is possible with the Bootstrap 4 carousel.
Essentially i'm looking to make a slider like in the above image but I can't figure out if it's possible to have the text on the left and the image on the right with the arrows.
Is this possible?
Any help is much appreciated.
I just have the default Bootstrap 4 carousel code at the moment.
<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="d-block w-100" src="..." alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="..." alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="..." 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>

Use the Bootstrap grid. For example 2 columns...
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row align-items-center">
<div class="col-md py-2">
<p> Text text text here. Text here, here, here, here is the text. Text here, here, here, here is the text. </p>
<button class="btn btn-primary">More here</button>
</div>
<div class="col-md py-2">
<img class="d-block img-fluid" src="..." alt="First slide">
</div>
</div>
</div>
<div class="carousel-item">
...
</div>
<div class="carousel-item">
...
</div>
</div>
</div>
Codeply demo

Related

Fit the image inside the carousel, cant seem to fix it

I am trying to fit the image inside the carousel, but I can't seem to fix it. Here is my css code:
<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="d-block w-100" src="images/Products/keyboard.jpg" alt="First slide">
<div class="carousel-caption d-md-block">
<h5 style="color:black">Welcome to LebShops</h5>
<p style="color:black">Proud to be Lebanese</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="images/Products/mouse.jpg" alt="Second slide">
<div class="carousel-caption d-md-block">
<h5 style="color:black">Enjoy our vast selection of products</h5>
<p style="color:black">Cash on delivery</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="images/Products/airpods.jpg" alt="Third slide">
<div class="carousel-caption d-md-block">
<h5 style="color:black">Whatever you need we got it !</h5>
<p style="color:black">Cash on delivery</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>
How can I fit my picture inside this carousel?
I've used css to adjust its height
I've checked other people's questions but it didnt help me.
Please see the below snippet. I have used different size images in the gallery.
The only change you need to add is css
img{
object-fit: cover;
vertical-align: middle;
border-style: none;
height: 70vh;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<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="d-block w-100" src="https://picsum.photos/id/100/200/250" alt="First slide">
<div class="carousel-caption d-md-block">
<h5 style="color:black">Welcome to LebShops</h5>
<p style="color:black">Proud to be Lebanese</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://picsum.photos/id/100/500/300" alt="Second slide">
<div class="carousel-caption d-md-block">
<h5 style="color:black">Enjoy our vast selection of products</h5>
<p style="color:black">Cash on delivery</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://picsum.photos/id/100/300/350" alt="Third slide">
<div class="carousel-caption d-md-block">
<h5 style="color:black">Whatever you need we got it !</h5>
<p style="color:black">Cash on delivery</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>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>

How to place 2 bootstrap carousel next to each other in mobile view?

I'm new to HTML and I'm trying to get carousels to display next to each other just like in the picture but I can't seem to make it work.
This is my code. The carousel works but I need it to be display side by side on mobile view. Is it a grid problem?? Anyone know how to solve it, thanks! Your help is gladly appreciated.
desired output
<div class="row">
<div class="col-md-6">
<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="d-block w-100" src="img/vege.jpg" alt="First slide">
<div class="carousel-caption d-none d-md-block">
<h5>Vegetables</h5>
<p>Producing more but consuming less</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/vege-red.jpg" alt="Second slide">
<div class="carousel-caption d-none d-md-block">
<h5>Red Label</h5>
<p>Vegetables Wine Industry</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/vege-green.jpg" alt="Third slide">
<div class="carousel-caption d-none d-md-block">
<h5>Broccoli</h5>
<p>Chemistry: Taste like Chicken</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>
<div class="col-md-6">
<div id="carouselExampleIndicators2" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators2" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators2" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators2" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="img/farm-01.jpg" alt="First slide">
<div class="carousel-caption d-none d-md-block">
<h5>Aquaphonics</h5>
<p>Producing without farm lot</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/farm-02.jpg" alt="Second slide">
<div class="carousel-caption d-none d-md-block">
<h5>Modern Farm tools</h5>
<p>Building and Growing Crops</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/farm-03.jpg" alt="Third slide">
<div class="carousel-caption d-none d-md-block">
<h5>Science of Farming</h5>
<p>Botany, Biology, Chemistry</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators2" 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="#carouselExampleIndicators2" 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> ```
You can add col-* class to adjust the columns in mobile view. Also, You don't even need to write col-md-* because the col-* will affect on all views.
for this example, it would be class="col-6".
<div class="container">
<div class="row">
<div class="col-6">
</div>
<div class="col-6">
</div>
</div>
</div>

Bootstrap 4 - Carousel with fixed background

I would like to create a carousel with a fixed background. Only the text should change.
I tried to put the same background-image into every slide but I don't like the switch animation. I think it would be better if only the text would change.
My code:
<div id="myCarousel" class="carousel slide" 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>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="first-slide" src="img/earth1.jpg" alt="First slide">
<div class="container">
<div class="carousel-caption text-left">
<h1>TEXT 1</h1>
<p id="screen"></p>
<p>text1</p>
</div>
</div>
</div>
<div class="carousel-item">
<img class="second-slide" src="img/earth1.jpg" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<h1>TEXT 2</h1>
<p id="screen"></p>
<p>text2</p>
</div>
</div>
</div>
<div class="carousel-item">
<img class="third-slide" src="img/earth1.jpg" alt="Third slide">
<div class="container">
<div class="carousel-caption text-right">
<h1>TEXT 3</h1>
<p id="screen"></p>
<p>text3</p>
</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel" 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="#myCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
What do I need to add?
Thank you,
Jay
you should try this: add new div above carousel item as shown below and set background image to it whatever you want, you can get same image on every slide, just style your content inside carousel item. you can also set min height to background image as shown in below code.
<div id="myCarousel" class="carousel slide" 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>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="img" style="background-image: url('your image path');">
<div class="carousel-item active">
<img class="first-slide" src="img/earth1.jpg" alt="First slide">
<div class="container">
<div class="carousel-caption text-left">
<h1>TEXT 1</h1>
<p id="screen"></p>
<p>text1</p>
</div>
</div>
</div>
<div class="carousel-item">
<img class="second-slide" src="img/earth1.jpg" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<h1>TEXT 2</h1>
<p id="screen"></p>
<p>text2</p>
</div>
</div>
</div>
<div class="carousel-item">
<img class="third-slide" src="img/earth1.jpg" alt="Third slide">
<div class="container">
<div class="carousel-caption text-right">
<h1>TEXT 3</h1>
<p id="screen"></p>
<p>text3</p>
</div>
</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel" 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="#myCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<style type="text/css">
.img{
background-repeat: no-repeat;
background-size: cover;
background-position: center;
min-height:400px;
}
</style>

Unexpected white background on top of carousel images in Bootstrap 4

I don't understand why an unexpected white background appears on top of the bootstrap 4 carousel when I apply a black background color. How can I correct this unexpected issue? You can find the example of this issue here https://codepen.io/edquijano/pen/MQxogR Thanks for your input.
<div class="carousel">
<div class="bg-dark">
<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="d-block w-100" src="images/hero.jpg" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="images/hero.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="images/hero.jpg" 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>
</div>
</div>
The carousel is enclosed in an overlay div, which comes with an opacity of 0.6. This makes the images look like they have a whitish cast over them.
You can either choose to remove the overlay div or explicity set opacity:1 on the images.
Here is the output with the overlay div removed: https://codepen.io/anon/pen/XZGevv

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>