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>
Related
I have been searching quite some time for this but unfortunately all questions/answers are mostly 6/8 years old. Now that Bootstrap has evolved so much, I want to ask the question as maybe someone knows how to do this.
My requirement is to have a carousel of cards that adapts based on viewport, for example:
Default size: 3 items
Mobile size: just 1 item
This snippet is perfect for my needs: https://gosnippets.com/snippets/bootstrap-carousel-with-cards-in-3-columns, however I was unable to achieve what I want.
I have also played around with Slick carousel, but frankly I'm not a fan. It does exactly what I need but it's outdated, bugged and I would be much happier to use just bootstrap.
My project uses Webpack so I am able to use SCSS if that helps.
Please let me know if it's possible to achieve what I want with just plain Bootstrap 5.
You can do that in plain bootstrap by calling two carousel. Here is the following code and hopefully you will understand the code pattern.
<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
<div class="carousel-inner d-none d-sm-block"> //d-none: display none for all devices, d-sm-block: hide on screens smaller than sm (width < 768px)
//loops start
<div class="carousel-item active">
<div class="container">
<div class="row">
<div class="col-sm">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="col-sm">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="col-sm">
<img src="..." class="d-block w-100" alt="...">
</div>
</div>
</div>
</div>
//loops end
</div>
<div class="carousel-inner d-sm-none">//d-sm-none: hide on sm (width < 768px) and wider screens
<div class="carousel-item active">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="...">
</div>
</div>
</div>
Wish you good luck.
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.
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
I'm currently working on my first ever website, this is using the twitter-bootstrap 4 framework. Everything was going swimmingly, until I have seemingly encountered the following issue.
I currently have this layout for my website:
Current Layout
When in fact I would like:
Desired Layout
I have attempted a plethora of solutions that I have found via browsing stack-overflow, such as nesting columns. None of it seems to work, I'm sure it is simply due to my inexperience, but I'm stumped as to how to get my desired appearance.
<div class="container-fluid bg-style-2">
<div class="row">
<div class="col-sm-9 par-style"><h2 class="par-heading">Welcome to my Website</h2>
</div>
<div class="col-sm-3">
<div id="myCarousel" class="carousel slide pull-right" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"><img src="img/Christina.JPG" alt="..."></li>
<li data-target="#myCarousel" data-slide-to="1"><img src="img/NickyAndChristina.JPG" alt="..."></li>
<li data-target="#myCarousel" data-slide-to="2"><img src="img/Nicky.JPG" alt="..."></li>
<li data-target="#myCarousel" data-slide-to="3"><img src="img/Meme.JPG" alt="..."></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="img/Christina.JPG" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/NickyAndChristina.JPG" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Nicky.JPG" alt="Third slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Meme.JPG" alt="Fourth slide">
</div>
</div>
</div>
</div>
</div>
</div> <!-- End of Carousel -->
<div class="container-fluid bg-style-2">
<div class="row">
<div class="col-sm-9 par-style"><h2 class="par-heading">Test Header</h2>
</div>
</div>
</div>
As seen above, I am trying to have a photo gallery slider to the right of my website and the formatting I have attached above, it simply will not work. Can someone please give me some guidance? I have been thoroughly enjoying working on this website, but I cannot progress until I have resolved this as it will plague my mind.
#nedge
https://jsfiddle.net/saurabhanand/4f0pztcu/2/
<div class="container">
<div class="row container-0">
<div class="col-sm-6">
<div class="row container-1">
<div class="col-sm-12">
<img class="rgt-side-img" src="https://via.placeholder.com/500x250">
</div>
</div>
<div class="row container-2">
<div class="col-sm-6">
<img class="rgt-side-img" src="https://via.placeholder.com/500">
</div>
<div class="col-sm-6">
<img class="rgt-side-img" src="https://via.placeholder.com/500">
</div>
</div>
</div>
<div class="col-sm-6">
<img class="rgt-side-img" src="https://via.placeholder.com/500">
</div>
</div>
</div>
I hope this one helps. You can replace img tag with your own contents.
I am using bootstrap columns that each have an image inside of different sizes which are aligned on full screen view however when using bootstrap's class img-fluid they resize for smaller viewports but instead of being aligned between the other images vertically the smaller images end up on the top of their div column.
Is there a way to vertically align these images while the image scales down?
Here is the markup:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-2">
<img src="http://via.placeholder.com/350x150" class="d-block img-fluid">
</div>
<div class="col-2">
<img src="http://via.placeholder.com/300x150" class="d-block img-fluid">
</div>
<div class="col-2">
<img src="http://via.placeholder.com/250x150" class="d-block img-fluid">
</div>
<div class="col-2">
<img src="http://via.placeholder.com/200x100" class="d-block img-fluid">
</div>
<div class="col-2">
<img src="http://via.placeholder.com/250x150" class="d-block img-fluid">
</div>
<div class="col-2">
<img src="http://via.placeholder.com/150x150" class="d-block img-fluid">
</div>
</div>
As you are using bootstrap 4, Just add align-items-center class in your row
For more help read Bootstrap4 Flex Grid
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="row align-items-center">
<div class="col-2">
<img src="http://via.placeholder.com/350x150" class="d-block img-fluid">
</div>
<div class="col-2 align-items-center">
<img src="http://via.placeholder.com/300x150" class="d-block img-fluid">
</div>
<div class="col-2">
<img src="http://via.placeholder.com/250x150" class="d-block img-fluid">
</div>
<div class="col-2">
<img src="http://via.placeholder.com/200x100" class="d-block img-fluid">
</div>
<div class="col-2">
<img src="http://via.placeholder.com/250x150" class="d-block img-fluid">
</div>
<div class="col-2">
<img src="http://via.placeholder.com/150x150" class="d-block img-fluid">
</div>
</div>