Bootstrap justify-content-around not spreading items - html

I'm trying to spread 3 rows of 4 bootstrap cards evenly across a jumbotron with space-around. This is the result:
I can't figure out why it's not spreading evenly. I'm not sure if there's a margin interfering thats included with bootstrap or something else. Here's my code:
<div class="jumbotron d-flex flex-column justify-content-around">
<div class="row">
<div class="card border-warning mb-3" style="max-width: 20rem;">
<div class="card-header">Bitcoin</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/bitcoin.png" alt="Bitcoin QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">bc1qnjpcl0xtywcuxuc7fr9s5gsnhkugnpf0udcn00</p>
</div>
</div>
<div class="card border-success mb-3" style="max-width: 20rem;">
<div class="card-header">Bitcoin Cash</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/cash.png" alt="Bitcoin Cash QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">qrrj4pcweu0v6vn37q4f6euqah6es5p93uqlcxr8kl</p>
</div>
</div>
<div class="card border-light mb-3" style="max-width: 20rem;">
<div class="card-header">Litecoin</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/litecoin.png" alt="Litecoin QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">LSTzUWZbAVRCgDMHjc9fjPM5PFRndKxnkK</p>
</div>
</div>
<div class="card border-ethereum mb-3" style="max-width: 20rem;">
<div class="card-header">Ethereum</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/ethereum.png" alt="Ethereum QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">0xe67F900395958c609Ad3098A0a85d8fCf19B6067</p>
</div>
</div>
</div>
<div class="row">
<div class="card border-info mb-3" style="max-width: 20rem;">
<div class="card-header">XRP</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/xrp.png" alt="XRP QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">rUS4KaEGr7Xdac5XAjeqEvSXpgewxHQjK1</p>
</div>
</div>
<div class="card border-monero mb-3" style="max-width: 20rem;">
<div class="card-header">Monero</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/monero.png" alt="Monero QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text monero">4AvkGD1MNUhB8dLgAYEUUK1UJxJuj6zXC9DDPb2ywYpRCZ1Y6yWGaxFfD3q8HAgbPXXqnqaGxiZGqjFtjULbgGDhAiLBX6M</p>
</div>
</div>
<div class="card border-info mb-3" style="max-width: 20rem;">
<div class="card-header">Dash</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/dash.png" alt="Dash QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">Xukc7xfRecEMMNuhDKb5Vb1MkoNe28Pson</p>
</div>
</div>
<div class="card border-warning mb-3" style="max-width: 20rem;">
<div class="card-header">ZCash</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/zcash.png" alt="ZCash QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">t1PN1dwc8brKkKhzWqZahwuarngs5STa9fy</p>
</div>
</div>
</div>
<div class="row">
<div class="card border-doge mb-3" style="max-width: 20rem;">
<div class="card-header">DogeCoin</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/dogecoin.png" alt="DogeCoin QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">DR6gfyGh2txp9eMpvuweQwUqPzqWc7VJBN</p>
</div>
</div>
<div class="card border-warning mb-3" style="max-width: 20rem;">
<div class="card-header">Bitcoin Gold</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/gold.png" alt="Bitcoin Gold QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">GTuJYM373DDa8qWYx4ryTwaDDpPkY5CxD9</p>
</div>
</div>
</div>
</div>
Here's my css, but it's just for extra border colors:
.border-ethereum{
border-color: #5c7de9 !important;
}
.border-monero{
border-color: #ff7a00 !important;
}
.border-doge{
border-color: #ceb73d !important;
}
.monero{
font-size: 10px;
}
Can someone help?

Remove <div class="row">. Change flex-column to flex-row in <div class="jumbotron d-flex flex-row justify-content-around">
/* Here's my css, but it's just for extra border colors: */
.border-ethereum {
border-color: #5c7de9 !important;
}
.border-monero {
border-color: #ff7a00 !important;
}
.border-doge {
border-color: #ceb73d !important;
}
.monero {
font-size: 10px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<div class="jumbotron d-flex flex-row justify-content-around">
<div class="card border-warning mb-3" style="max-width: 20rem;">
<div class="card-header">Bitcoin</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/bitcoin.png" alt="Bitcoin QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">bc1qnjpcl0xtywcuxuc7fr9s5gsnhkugnpf0udcn00</p>
</div>
</div>
<div class="card border-success mb-3" style="max-width: 20rem;">
<div class="card-header">Bitcoin Cash</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/cash.png" alt="Bitcoin Cash QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">qrrj4pcweu0v6vn37q4f6euqah6es5p93uqlcxr8kl</p>
</div>
</div>
<div class="card border-light mb-3" style="max-width: 20rem;">
<div class="card-header">Litecoin</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/litecoin.png" alt="Litecoin QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">LSTzUWZbAVRCgDMHjc9fjPM5PFRndKxnkK</p>
</div>
</div>
<div class="card border-ethereum mb-3" style="max-width: 20rem;">
<div class="card-header">Ethereum</div>
<div class="card-body">
<div class="text-center">
<img src="wallets/ethereum.png" alt="Ethereum QR Code" width="60%" height="60%" />
</div>
<br>
<p class="card-text">0xe67F900395958c609Ad3098A0a85d8fCf19B6067</p>
</div>
</div>
</div>

Related

Bootstrap Card images are not contained perfectly around corners

I'm trying to build a portfolio with bootstrap cards where images are also required to be displayed.
Problem is that images are not contained properly within bootstrap card around corners(with class="card-img-top") like some cards are not rounded or some images are not rounded but cards are rounded(tried class="img-rounded").
Kindly zoom in on the images to see the difference. Below are some snippets (and code is given below the snippets):-
Perfect card with image:-
Yellow-> difference
Bug-1:-
Bug-2:-
Bug-3:-
Bug-4:-
Code:-
<%- include('partials/headHTML') %>
<link rel="stylesheet" href="/css/tourpackageStyles.css">
</head>
<!-- <%- include('partials/header') %> -->
<div class="Container">
<div class="container-fluid">
<div class="row">
<div class="col col-md-4">
<div class="card h-100">
<img src="https://cdn.pixabay.com/photo/2022/06/05/20/24/rome-7244828_960_720.jpg" alt="" class="card-img-top">
<div class="card-body">
<div class="card-title">Title-1</div>
</div>
<a target="_blank" rel="noopener noreffer" href="#" role="button"
class="btn btn-sm btn-secondary">Enquire</a>
</div>
</div>
<div class="col col-md-4">
<div class="card h-100">
<img src="/images/wildlife/wildlife_tour.jpg"
alt=""
class="card-img-top">
<div class="card-body">
<div class="card-title">Title- 2</div>
</div>
<a target="_blank" rel="noopener noreffer" href="#"
class="btn btn-sm btn-secondary">Enquire</a>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row row-cols-1 row-cols-md-3 row-cols-sm-2 gy-3">
<div class="col">
<div class="card h-100">
<img src="https://cdn.pixabay.com/photo/2022/06/05/20/24/rome-7244828_960_720.jpg" alt="" class="card-img-top">
<div class="card-body">
<div class="card-title">
Title- 3
</div>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="https://cdn.pixabay.com/photo/2022/06/05/20/24/rome-7244828_960_720.jpg" alt="" class="card-img-top">
<div class="card-body">
<div class="card-title">
Title- 4
</div>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="https://cdn.pixabay.com/photo/2022/06/05/20/24/rome-7244828_960_720.jpg" alt="" class="card-img-top">
<div class="card-body">
<div class="card-title">
Title- 5
</div>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="" alt="">
<div class="card-body">
<div class="card-title">
Title- 6
</div>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="" alt="">
<div class="card-body">
<div class="card-title">
Title- 7
</div>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="" alt="">
<div class="card-body">
<div class="card-title">
Title- 8
</div>
</div>
</div>
</div>
</div>
</div>
</div>
If you wish to display only image while using card then place image inside card-body to achieve what you want and give card class "overflow-hidden". Because if you use "card-img-top" and then it has only border-top-left-radius and border-top-right-radius so image wouldn't be rounded on bottom.so you have to provide border-radius manually to both bottom side.
<div class="card overflow-hidden">
<div class="card-body">
<img class="img-fluid" src="" alt="">
</div>
</div>
For more information refer official docs https://getbootstrap.com/docs/5.2/components/card/

How can I place a text below another text when they're in the same row but in different columns?

I was wondering how can I place a text below another text when they're in the same row but in different columns?
This is image shows my current situation and goals. I applied a border attribute to see how the row and columns were distributed.
This is my HTML code:
<!-- Bootstrap-4 -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- Body -->
<div class="row mt-3">
<div class="col-7 border d-flex justify-content-start">
<p class="mb-3 b d-block text-right" style="color: #00A0DE; font-size: 50px;">Choose it</p>
<br> <br>
<p class="d-block b border" style="padding-top:40px; color: #323e48;">Select your favorite <br>product</p>
<img src="../../../assets/images/Generals/Number1.PNG" alt="" style="align-self: center;" width="100" height="100" style="margin-left:500px;">
</div>
<div class="col-5">
<div class="semirounded-square-2">
<div>
<img src="../../../assets/images/Generals/Character_1.png" alt="" width="250" style="padding-bottom: 100px;">
</div>
</div>
</div>
</div>
Any ideas how can I distribute my HTML elements in a way that it resembles the desired result?
If you want this behavior for mobile screens you can change the display property for col-7's flex property on responsive view
#media screen and (max-width: 767px) {
.col-7.d-flex {
display: block!important;
}
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css">
<div class="row mt-3">
<div class="col-7 border d-flex justify-content-start">
<p class="mb-3 b d-block text-right" style="color: #00A0DE; font-size: 50px;">Choose it</p>
<br> <br>
<p class="d-block b border" style="padding-top:40px; color: #323e48;">Select your favorite <br>product</p>
</div>
<div class="col-5 d-flex">
<img src="../../../assets/images/Generals/Number1.PNG" alt=""
style="align-self: center;" width="100" height="100" style="margin-left:500px;">
<div class="semirounded-square-2">
<div>
<img src="https://picsum.photos/id/237/200/300"
alt="" width="250" style="padding-bottom: 100px;">
</div>
</div>
</div>
</div>
Make sure to wrap both images in a same div
Else
If you want the same behavior desktop view you can try this
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css">
<div class="row mt-3">
<div class="col-5 border d-flex justify-content-start">
<p class=" text-right" style="color: #00A0DE; font-size: 50px;">Choose it <span class='d-block' style="color:black; font-size:20px;">Select your favorite </span> <span class='d-block text-center' style="color:black; font-size:20px;">product</span></p>
<img src="../../../assets/images/Generals/Number1.PNG" alt=""
style="align-self: center;" width="100" height="100" style="margin-left:500px;">
</div>
<div class="col-4">
<div class="semirounded-square-2">
<div>
<img src="../../../assets/images/Generals/Character_1.png"
alt="" width="250" style="padding-bottom: 100px;">
</div>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-5 border d-flex justify-content-start">
<p class=" text-right" style="color: #00A0DE; font-size: 50px;">Choose it <span class='d-block' style="color:black; font-size:20px;">Select your favorite </span> <span class='d-block text-center' style="color:black; font-size:20px;">product</span></p>
<img src="../../../assets/images/Generals/Number1.PNG" alt=""
style="align-self: center;" width="100" height="100" style="margin-left:500px;">
</div>
<div class="col-4">
<div class="semirounded-square-2">
<div>
<img src="../../../assets/images/Generals/Character_1.png"
alt="" width="250" style="padding-bottom: 100px;">
</div>
</div>
</div>
</div>

Adding texts beside an image using Bootstrap

I am having trouble figuring out how to adjust every <p> tag. It always goes beside the the name should be here. I want the should be below the name.
<div class="card" style="width: 25rem;">
<div class="card-body bg-light">
<h5 class="card-title text-center">The title should be here...</h5>
</div>
<div class="card-img-top d-flex align-items-top bg-light p-2">
<div>
<a class="fancybox" href="admin/files/Images/ProfilePicture.png">
<img src="admin/files/Images/ProfilePicture.png" style="width: 100px; height: 100px">
</a>
</div>
<p class="col p-2 m-0">The name should be here...</p>
</div>
<div>
</div>
</div>
Try this
<div class="card" style="width: 25rem;">
<div class="card-body bg-light">
<h5 class="card-title text-center">The title should be here...</h5>
</div>
<div class="card-img-top d-flex align-items-top bg-light p-2">
<div>
<a class="fancybox" href="admin/files/Images/ProfilePicture.png">
<img src="admin/files/Images/ProfilePicture.png" style="width: 100px; height: 100px">
</a>
</div>
<div class="card-body">
<p class="card-text">The name should be here...</p>
<p class="card-text">age</p>
<p class="card-text">address</p>
</div>
</div>
</div>
Below will also work
<div class="card" style="width: 25rem;">
<div class="card-body bg-light">
<h5 class="card-title text-center">The title should be here...</h5>
</div>
<div class="card-img-top d-flex align-items-top bg-light p-2">
<div>
<a class="fancybox" href="admin/files/Images/ProfilePicture.png">
<img src="admin/files/Images/ProfilePicture.png" style="width: 100px; height: 100px">
</a>
</div>
<table cellpadding="0" cellspacing="0">
<tr><td><p class="col p-2 m-0">The name should be here...</p></td></tr>
<tr><td><p class="col p-2 m-0">Age</p></td></tr>
<tr><td><p class="col p-2 m-0">Address</p></td></tr>
</table>
</div>
<div>
</div>
</div>

Why button is overlapping with images in css?

I am new to web devlopment and stuck on this issue for quite some time now.
I wish to make a table(in 2nd col-6) with buttons at top and than changing content(scrollable cards) below it based on button click.
I tried to implement it but my cards and buttons overlap how to tackle this and overlapping makes buttons non reactive.
<div class="Container">
<div class="row">
<div class="col-md-6 ">
<div > this is the table</div>
</div>
<div class="col-md-6 ">
<div class="container">
<div >
<div v-for="(eachbutton, index) in getbuttons" :key="index" style="color:#ffff">
<button class="tablink" style="margin-bottom:12px" #click="changeList(eachWidget.displayTitle)" id="defaultOpen">{{eachbutton.displayTitle}}</button>
</div>
</div>
<div v-for="(each, index) in getCarddata" :key="index" style="color:#ffff">
<div class="col-md-4 col-12 " style="width: 200px; height:90px margin-top: 90px">
<div class="card mb-6" style="background-color: #050b06;">
<div class="row g-0 ">
<div class="col-md-6 col-6 w-100 h-100">
<img class="w-100 h-100" style="margin:11px" :src="each.ImageUrl" alt="..." />
</div>
<div class="col-md-6 col-6">
<p class="card-text text-episode" style="text-align: left; color:#fff;">
<small class="text-muted"> card</small>
</p>
<p class="card-text text-start" style="text-align: left;">
<small class="text-muted">text</small
>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I hope you are using bootstrap 4 or higher, Try this
<div class="Container">
<div class="row">
<div class="col-md-6 ">
<div > this is the table</div>
</div>
<div class="col-md-6 ">
<div class="row">
<div class="col-md-12">
<div v-for="(eachbutton, index) in getbuttons" :key="index" style="color:#ffff">
<button class="tablink" style="margin-bottom:12px" #click="changeList(eachWidget.displayTitle)" id="defaultOpen">{{eachbutton.displayTitle}}</button>
</div>
</div>
<div class="col-md-12">
<div v-for="(each, index) in getCarddata" :key="index" style="color:#ffff">
<div class="col-md-4 col-12 " style="width: 200px; height:90px margin-top: 90px">
<div class="card mb-6" style="background-color: #050b06;">
<div class="row g-0 ">
<div class="col-md-6 col-6 w-100 h-100">
<img class="w-100 h-100" style="margin:11px" :src="each.ImageUrl" alt="..." />
</div>
<div class="col-md-6 col-6">
<p class="card-text text-episode" style="text-align: left; color:#fff;">
<small class="text-muted"> card</small>
</p>
<p class="card-text text-start" style="text-align: left;">
<small class="text-muted">text</small
>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

How to center last two cards in bootstrap?

I write application in angular, using bootstrap. I want the last 2 cards to be in the middle, instead of to the left. Now it looks like one last card is missing. I want to correct it. How to do it?
html code:
<div class="container" style="padding-top:1.1cm">
<div class="card-columns">
<div class="card text-center" [routerLink]="['/special/arrangements-salon']">
<div class="card-body">
<img [src]="salon" height="100" width="100"><br><label>
<h5 style="padding-top:6mm">salon</h5>
</label>
</div>
</div>
<div class="card text-center" [routerLink]="['/special/arrangements-study']">
<div class="card-body">
<img [src]="study" height="100" width="100"><br><label>
<h5 style="padding-top:6mm">gabinet</h5>
</label>
</div>
</div>
<div class="card text-center" [routerLink]="['/special/arrangements-bedroom']">
<div class="card-body">
<img [src]="bedroom" height="100" width="100"> <br><label>
<h5 style="padding-top:6mm">sypialnia
</h5>
</label>
</div>
</div>
<div class="card text-center" [routerLink]="['/special/arrangements-kitchen']">
<div class="card-body">
<img [src]="kitchen" height="100" width="100"> <br><label>
<h5 style="padding-top:6mm">kuchnia
</h5>
</label>
</div>
</div>
<div class="card text-center" [routerLink]="['/special/arrangements-bathroom']">
<div class="card-body">
<img [src]="bathroom" height="100" width="100"><br><label>
<h5 style="padding-top:6mm">Ĺ‚azienka</h5>
</label>
</div>
</div>
</div>
</div>
add d-flex align-items-center justify-content-center to parent => card-columns div or you can add mx-auto to last div
<div class="container" style="padding-top:1.1cm">
<div class="card-columns d-flex align-items-center justify-content-center">
<div class="card text-center" [routerLink]="['/special/arrangements-salon']">
<div class="card-body">
<img [src]="salon" height="100" width="100"><br><label>
<h5 style="padding-top:6mm">salon</h5>
</label>
</div>
</div>
<div class="card text-center" [routerLink]="['/special/arrangements-study']">
<div class="card-body">
<img [src]="study" height="100" width="100"><br><label>
<h5 style="padding-top:6mm">gabinet</h5>
</label>
</div>
</div>
<div class="card text-center" [routerLink]="['/special/arrangements-bedroom']">
<div class="card-body">
<img [src]="bedroom" height="100" width="100"> <br><label>
<h5 style="padding-top:6mm">sypialnia
</h5>
</label>
</div>
</div>
<div class="card text-center" [routerLink]="['/special/arrangements-kitchen']">
<div class="card-body">
<img [src]="kitchen" height="100" width="100"> <br><label>
<h5 style="padding-top:6mm">kuchnia
</h5>
</label>
</div>
</div>
<div class="card text-center" [routerLink]="['/special/arrangements-bathroom']">
<div class="card-body">
<img [src]="bathroom" height="100" width="100"><br><label>
<h5 style="padding-top:6mm">Ĺ‚azienka</h5>
</label>
</div>
</div>
</div>
</div>
Bootstrap card-columns uses CSS multi columns and for various reason it's not really possible to center items, or align rows differently.
Instead of using card-columns, use the grid (row > col-*), but you should note this won't give you a masonry layout or top-to-bottom ordering.