how to create a responsive carousel - html

I want to create a carousel(class="carousel-inner ") and display an icon(class="scroll-icon") into it. But I cannot make it responsive so the icon's position cannot be responsive. how to make a responsive carousel-inner?
large screen
small screen(blue area belongs to carousel-inner)
<div class="home">
<div class="banner">
<div id="carouselExampleSlidesOnly" class="carousel slide d-none d-md-block " data-ride="carousel">
<div class="carousel-inner " style="height: 1300px ">
<div class="carousel-item active" data-aos="fade-in">
<img class="d-block w-100 img-fluid" data-aos="fade-down" src="{{asset('images/home/deneme.jpg')}}" alt="First slide" >
</div>
<div class="carousel-item" data-aos="fade-in">
<img class="d-block w-100 img-fluid" data-aos="fade-in" src="{{asset('images/home/carousel2.jpg')}}" alt="Second slide">
</div>
<div class="carousel-item" data-aos="fade-in">
<img class="d-block w-100 img-fluid" data-aos="fade-in" src="{{asset('images/home/carousel3-2.jpg')}}" alt="Third slide">
</div>
</div>
</div>
<img class="scroll-icon" style="position: absolute; z-index: 999999999999; left: 50%; top:700px" src="{{asset("/images/scroll.svg")}}"/>
</div>

Change top:700px to bottom: 0 on your icon's style attribute:
<img class="scroll-icon" style="position: absolute; z-index: 999999999999; left: 50%; bottom: 0" src="{{asset("/images/scroll.svg")}}"/>
Have in mind that this will move your scroll icon to the bottom of the .banner div.

Related

slider HTML : align text and button in middle slider bootstrap 4

in below code i want to align button,logo and text in center of images slider in bootstrap4 but here in my code it's not showing same on all devices plus i need to change css on every screen and this is a bad way i think... is there a better way to do this ?
thanks in advance
.wrapper {
position: absolute;
bottom: 250px;
left: 18%;
}
#media (min-width:320px) {
.wrapper {
position: absolute;
bottom: 139px;
left: 18%;
}
}
#media (min-width:480px) {
.wrapper {
position: absolute;
bottom: 250px;
left: 18%;
}
}
#media (min-width:801px) {
.wrapper {
position: absolute;
bottom: 280px;
left: 18%;
}
}
<div class="container-fluid main">
<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">
<img class="d-block w-100 " src="assets/images/dgWebsiteImages-25.jpg" alt="First Image">
<div class="carousel-caption ">
<img class="" src="https://www.google.com/url?sa=i&url=https%3A%2F%2Fpixabay.com%2Fimages%2Fsearch%2Fnature%2F&psig=AOvVaw2OejUw2y467GfAvPkIg7bK&ust=1667036104481000&source=images&cd=vfe&ved=0CA0QjRxqFwoTCMCZ9srPgvsCFQAAAAAdAAAAABAD" style="background-repeat: no-repeat;"
alt="First Image">
<div class="textslider">
<h2>text text text text text text</h2>
</div>
<div class="wrapper">
<a class="ripple rbutton" href="https://">Visit Website</a>
</div>
</div>
</div>
</div>
</div>
</div>
Here is the solution
<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="data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22800%22%20height%3D%22400%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20800%20400%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_184273a4147%20text%20%7B%20fill%3A%23555%3Bfont-weight%3Anormal%3Bfont-family%3AHelvetica%2C%20monospace%3Bfont-size%3A40pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_184273a4147%22%3E%3Crect%20width%3D%22800%22%20height%3D%22400%22%20fill%3D%22%23777%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%22285.9140625%22%20y%3D%22217.7%22%3EFirst%20slide%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E"
alt="First slide"
/>
<div class="carousel-caption d-none d-md-block">
<img
class=""
src="https://www.google.com/url?sa=i&url=https%3A%2F%2Fpixabay.com%2Fimages%2Fsearch%2Fnature%2F&psig=AOvVaw2OejUw2y467GfAvPkIg7bK&ust=1667036104481000&source=images&cd=vfe&ved=0CA0QjRxqFwoTCMCZ9srPgvsCFQAAAAAdAAAAABAD"
style="background-repeat: no-repeat"
alt="First Image"
/>
<div class="textslider">
<h2>text text text text text text</h2>
</div>
<div class="wrapper">
<a class="ripple rbutton" href="https://">Visit Website</a>
</div>
</div>
</div>
<div class="carousel-item">
<img
class="d-block w-100"
src="data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22800%22%20height%3D%22400%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20800%20400%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_184273a4148%20text%20%7B%20fill%3A%23444%3Bfont-weight%3Anormal%3Bfont-family%3AHelvetica%2C%20monospace%3Bfont-size%3A40pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_184273a4148%22%3E%3Crect%20width%3D%22800%22%20height%3D%22400%22%20fill%3D%22%23666%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%22247.3125%22%20y%3D%22217.7%22%3ESecond%20slide%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E"
alt="Second slide"
/>
<div class="carousel-caption d-none d-md-block">
<img
class=""
src="https://www.google.com/url?sa=i&url=https%3A%2F%2Fpixabay.com%2Fimages%2Fsearch%2Fnature%2F&psig=AOvVaw2OejUw2y467GfAvPkIg7bK&ust=1667036104481000&source=images&cd=vfe&ved=0CA0QjRxqFwoTCMCZ9srPgvsCFQAAAAAdAAAAABAD"
style="background-repeat: no-repeat"
alt="First Image"
/>
<div class="textslider">
<h2>text text text text text text</h2>
</div>
<div class="wrapper">
<a class="ripple rbutton" href="https://">Visit Website</a>
</div>
</div>
</div>
<div class="carousel-item">
<img
class="d-block w-100"
src="data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22800%22%20height%3D%22400%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20800%20400%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_184273a4148%20text%20%7B%20fill%3A%23333%3Bfont-weight%3Anormal%3Bfont-family%3AHelvetica%2C%20monospace%3Bfont-size%3A40pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_184273a4148%22%3E%3Crect%20width%3D%22800%22%20height%3D%22400%22%20fill%3D%22%23555%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%22276.9921875%22%20y%3D%22217.7%22%3EThird%20slide%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E"
alt="Third slide"
/>
<div class="carousel-caption d-none d-md-block">
<img
class=""
src="https://www.google.com/url?sa=i&url=https%3A%2F%2Fpixabay.com%2Fimages%2Fsearch%2Fnature%2F&psig=AOvVaw2OejUw2y467GfAvPkIg7bK&ust=1667036104481000&source=images&cd=vfe&ved=0CA0QjRxqFwoTCMCZ9srPgvsCFQAAAAAdAAAAABAD"
style="background-repeat: no-repeat"
alt="First Image"
/>
<div class="textslider">
<h2>text text text text text text</h2>
</div>
<div class="wrapper">
<a class="ripple rbutton" href="https://">Visit Website</a>
</div>
</div>
</div>
</div>
</div>
Just use this css
div.carousel-caption {
top: 50%;
left: 50%;
bottom: auto;
transform: translate(-50%, -50%);
}

How to place carousel and text side by side bootstrap?

I want a carousel to occupy half the page and to be aligned to the right while the text should be aligned to the left of the box.
I am using bootstrap. Here is my html:
.main{
display: flex;
align-items: center;
}
#events{
display: flex;
justify-content: space-evenly ;
}
.card{
border-radius: 5%;
}
#myNavbar{
align-items: center;
}
.impact{
margin: 10px;
}
<div class="main">
<div class="impact">
<span>
IMPACTING THE BANGLADESHI COMMUNITY IN OMAN!
</span>
</div>
<div id="carousel" class="carousel slide impact" data-bs-ride="carousel">
<div class="carousel-inner impact" style="height: 500px;">
<div class="carousel-item active">
<img src="{% static 'social_club/web1.jpg' %}" class="d-block w-100 h-100" alt="">
</div>
<div class="carousel-item">
<img src="{% static 'social_club/web2.jpg' %}" class="d-block w-100" alt="">
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="..."> </div>
</div>
</div>
</div>
Could someone please tell me how I can make this possible? I have searched quite a lot about making the carousel only occupy half the page, but without results.
If you are using Bootstrap 4 or Bootstrap 5, you have no need to add custom CSS. You can achieve this by using Bootstrap classes. In the following code snippet, I am using Bootstrap 5.
Here is the complete implementation of your code. Please make sure to add closing tags correctly.
Note: Don't add static height to any element for an accurate vertically center alignment effect.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="main d-flex align-items-center">
<div class="impact w-50">
<span>
IMPACTING THE BANGLADESHI COMMUNITY IN OMAN!
</span>
</div>
<div id="carousel" class="carousel slide impact w-50" data-bs-ride="carousel">
<div class="carousel-inner impact">
<div class="carousel-item active">
<img src="https://blog.getbootstrap.com/assets/img/2020/06/v5-new-logo.png" class="d-block w-100 h-100" alt="">
</div>
<div class="carousel-item">
<img src="https://www.winklix.com/blog/wp-content/uploads/2021/01/f1ce6a0af5cb.jpg.png" class="d-block w-100" alt="">
</div>
<div class="carousel-item">
<img src="https://htmlburger.com/blog/wp-content/uploads/2021/02/lets-talk-about-bootstrap.png" class="d-block w-100" alt="...">
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js"></script>

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>

Bootstrap slider not giving the expected result

I was trying to make a carousel for my website using Bootstrap, but the carousel just gives me this icon:
My Google dev tools did not give me errors, the same can be said for Pycharm; no errors. Here is my code:
<div class="container">
<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="C:\Users\pert\PycharmProjects\milestonewebsite\images\one.jpg" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="C:\Users\pert\PycharmProjects\milestonewebsite\images\two.jpg" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="C:\Users\pert\PycharmProjects\milestonewebsite\images\three.jpg" class="d-block w-100" alt="...">
</div>
</div>
</div>
</div>
ok, i found out the problem, for some reson, my computer only accepted gif links, now it is working properly

Adding URL link to a picture

So I have this carousel making my website 'fancy'. But I want to link the individual pictures to the websites it should got to once clicked on.
The following is my code:
<div class="carousel-item active">
<img class="d-block w-100" src="images/ncaa-bb-banner-1920x500 (1).png" alt="First slide" >
<div class="carousel-caption d-none d-md-block" >
<h5 href="sportsevents.php">Sport Events</h5>
</div>
</div>
I have added href="sportsevents.php" to the first div, img and the second div, but it doesn't seem to link up. Am I having a brain fart and missing something or is there something else I should do?
You can do like this and get desired result.
<div class="carousel-item active">
<img class="d-block w-100" src="images/ncaa-bb-banner-1920x500 (1).png" alt="First slide" >
<div class="carousel-caption d-none d-md-block" >
<h5>Sport Events</h5>
</div>
</div>