The numbers are going to the next line, how to adjust them to come in the same line without changing others size?
Run the below script in full screen:
.card-body {
display: flex;
}
.card-title {
margin-left: auto;
font-family: 'Yatra One', cursive;
}
#media(min-width:768px) {
.card-title {
font-size: 3vw;
word-break: break-all;
}
}
#media(max-width:767px) {
.card-title {
font-size: 10vw;
word-break: break-all;
}
}
.col-10 {
height: 65px;
}
.col-2 {
height: 65px;
}
.img-fluid {
height: 100%!important;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Yatra+One&display=swap" rel="stylesheet">
<div class="row">
<div class="shadow-self card col-md-3 ml-4 mt-3 mb-3 mr-4 border-0" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="100">
<h5 class="card-title float-right">9700005243</h5>
</div>
<div class="card-body col-12 border p-0">
Get Details
</div>
</div>
</div>
<div class="shadow-self card col-md-3 ml-4 mt-3 mb-3 mr-4 border-0" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="100">
<h5 class="card-title float-right">9700005243</h5>
</div>
<div class="card-body col-12 border p-0">
Get Details
</div>
</div>
</div>
<div class="shadow-self card col-md-3 ml-4 mt-3 mb-3 mr-4 border-0" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="100">
<h5 class="card-title float-right">9700005218</h5>
</div>
<div class="card-body col-12 border p-0">
Get Details
</div>
</div>
</div>
<div class="shadow-self card col-md-3 ml-4 mt-3 mb-3 mr-4 border-0" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="100">
<h5 class="card-title float-right">9700005218</h5>
</div>
<div class="card-body col-12 border p-0">
Get Details
</div>
</div>
</div>
<div class="shadow-self card col-md-3 ml-4 mt-3 mb-3 mr-4 border-0" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="100">
<h5 class="card-title float-right">9700005218</h5>
</div>
<div class="card-body col-12 border p-0">
Get Details
</div>
</div>
</div>
<div class="shadow-self card col-md-3 ml-4 mt-3 mb-3 mr-4 border-0" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="100">
<h5 class="card-title float-right">1111111111</h5>
</div>
<div class="card-body col-12 border p-0">
Get Details
</div>
</div>
</div>
</div>
The numbers are going to the next line, how to adjust them to come in the same line without changing others size?
Also how to display numbers in the middle? (same space in top and bottom)
By default Boostrap wrote word-break: break-all; Changed to word-break: keep-all;
Read this
word-break w3 school
#media (min-width: 768px)
.card-title {
font-size: 3vw;
word-break: keep-all !important;
}
You can add margin: auto to center them and white-space: nowrap to prevent them from wrapping to the next line. Also, I'd suggest making font a bit smaller when resizing screen and/or making blocks bigger.
In case you want them to be absolutely centered and you don't care about overlapping the image, give them:
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
Related
What I want to achieve is that my DIV element is not cut off by the Print option. I have used the code BREAK-INSIDE: AVOID code and it doesn't work, in the end my DIV ends up sliced in half.
HTML
<block-ui></block-ui>
<div class="content-wrapper container-xxl p-0">
<div class="content-body">
<div class="card">
<div class="row">
<div class="col-xl-9 col-md-8 col-12">
<div class="row m-1">
<div class="m-1 dont-break" *ngFor="let QRID of printData.results">
<div class="d-flex align-items-center flex-column"
style="width: 4.5cm; height: 8cm; max-width: 4.5cm; border: 1px dashed #000000; padding: .25cm;">
<h6 class="mb-0" style="font-size: 10px;">Name:</h6>
<h6 class="mb-30">{{ QRID.proyecto }}</h6>
<img [src]="QRID.foto" style="height: 3.5cm; width: 3.5cm; margin-bottom: 7px;">
<ngx-qrcode-styling [config]="config" [type]="'canvas'" [shape]="'square'" [width]="110" [height]="110"
[margin]="0" [data]="QRID.qr">
</ngx-qrcode-styling>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-4 col-12 invoice-actions mt-md-0 mt-2">
<div class="card">
<div class="card-body">
<a class="btn btn-outline-secondary btn-block mb-75" href="javascript:window.print();" rippleEffect>
Print
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
CSS
#media print {
div.dont-break {
break-inside: avoid !important;
page-break-inside: avoid !important;
-webkit-break-inside: avoid !important;
}
}
I have a row of 3 different columns which change sizes depending on the screen size. However, when I shrink the screen, I want the margin to change only for a certain number of boxes. For example, this is what it looks like when there is no margin on the left or right.
XL Screen
This is what it looks like when I scale down the screen size with no margin.
L Screen
However, when I change the margin to "mr-4", the boxes do not scale down the same way. Here is how it looks with margin on the first and second boxes.
XL Screen
L Screen
This is the html I'm working with
.cram-set-header{
color: #042157;
margin-bottom: 9px;
}
.cram-set{
background-color: #ffffff;
height: 120px;
padding-top: 32px;
border-radius: 5px;
box-shadow: 0px 3px 6px #CBCBCB;
padding-left: 28px;
}
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
<div id="subject-container" class="container-fluid">
<div class="row">
<div class="col-2">
</div>
<div class="col-8">
<div class="row">
<div class="row pt-1">
<h3 id="subject-text">My Sets</h3>
<span class="num-cram-sets pt-1 ml-2">- 8 Cram Sets</span>
</div>
<div class="row ml-auto">
<div class="col-8 pr-0 pb-3">
<button class="btn" id="sign-up-button" data-toggle="modal" data-target="#uploadModal">Upload</button>
</div>
</div>
</div>
<div class="row">
<div class="row col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 cram-set mb-3 mr-4">
<h5 class="cram-set-header mb-0">Marketing - Cram Set #1</h5>
<div class="row pl-3">
<p class="mr-1">5.0</p>
<img src="img/star-rating.png" alt="" height="16px">
<p class="ml-2">1,034 Questions</p>
</div>
</div>
<div class="row col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 cram-set mb-3">
<h5 class="cram-set-header mb-0">Marketing - Cram Set #1</h5>
<div class="row pl-3">
<p class="mr-1">5.0</p>
<img src="img/star-rating.png" alt="" height="16px">
<p class="ml-2">1,034 Questions</p>
</div>
</div>
<div class="row col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 cram-set mb-3">
<h5 class="cram-set-header mb-0">Marketing - Cram Set #1</h5>
<div class="row pl-3">
<p class="mr-1">5.0</p>
<img src="img/star-rating.png" alt="" height="16px">
<p class="ml-2">1,034 Questions</p>
</div>
</div>
<div class="row col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 cram-set">
<h5 class="cram-set-header mb-0">Marketing - Cram Set #1</h5>
<div class="row pl-3">
<p class="mr-1">5.0</p>
<img src="img/star-rating.png" alt="" height="16px">
<p class="ml-2">1,034 Questions</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-2">
</div>
</div>
</body>
I want to be able to mantain the margin between boxes when the screen size is minimized. I thought about creating a class and then using media queries to change the margin depending on screen size, but I need every box to have margin at some point.
For example, in the XL screen size, I do not want right margin on the box on the right because I want it to be flush with the end of the column.
https://repl.it/join/tgbodxoh-claytonhorning
To solve that I suggest you use flex-wrap: wrap. I add some classes to your HTML and fixed the problem. I hope you like it.
For the XL screen, I made row-container flex-wrap: nowrap because otherwise, it will send the box to the next line earlier.
.row-container {
display:flex;
flex:0 0 100%;
flex-wrap:nowrap;
align-items:center;
justify-content:center;
}
.cram-set-header{
color: #042157;
margin-bottom: 9px;
}
.cram-set{
flex-basis:25%;
background-color: #ffffff;
height: 120px;
padding-top: 32px;
border-radius: 5px;
box-shadow: 0px 3px 6px #CBCBCB;
padding-left: 28px;
margin:10px;
}
.row-header {
display:flex;
flex-direction:row;
flex:0 0 100%;
}
.row-header .row.pt-1 {
flex-basis:50%;
margin:10px;
}
.row-header .row.ml-auto {
display:flex;
justify-content:flex-end;
flex-basis:50%;
margin:30px;
}
#media screen and (max-width:991px){
.row-container {
flex-wrap:wrap;
}
}
<body>
<div id="subject-container" class="container-fluid">
<div class="row">
<div class="col-2">
</div>
<div class="col-8">
<div class="row row-header">
<div class="row pt-1">
<h3 id="subject-text">My Sets</h3>
<span class="num-cram-sets pt-1 ml-2">- 8 Cram Sets</span>
</div>
<div class="row ml-auto">
<div class="col-8 pr-0 pb-3">
<button class="btn" id="sign-up-button" data-toggle="modal" data-target="#uploadModal">Upload</button>
</div>
</div>
</div>
<div class="row row-container">
<div class="row col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 cram-set mb-3 mr-4">
<h5 class="cram-set-header mb-0">Marketing - Cram Set #1</h5>
<div class="row pl-3">
<p class="mr-1">5.0</p>
<img src="img/star-rating.png" alt="" height="16px">
<p class="ml-2">1,034 Questions</p>
</div>
</div>
<div class="row col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 cram-set mb-3">
<h5 class="cram-set-header mb-0">Marketing - Cram Set #1</h5>
<div class="row pl-3">
<p class="mr-1">5.0</p>
<img src="img/star-rating.png" alt="" height="16px">
<p class="ml-2">1,034 Questions</p>
</div>
</div>
<div class="row col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 cram-set mb-3">
<h5 class="cram-set-header mb-0">Marketing - Cram Set #1</h5>
<div class="row pl-3">
<p class="mr-1">5.0</p>
<img src="img/star-rating.png" alt="" height="16px">
<p class="ml-2">1,034 Questions</p>
</div>
</div>
<div class="row col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 cram-set">
<h5 class="cram-set-header mb-0">Marketing - Cram Set #1</h5>
<div class="row pl-3">
<p class="mr-1">5.0</p>
<img src="img/star-rating.png" alt="" height="16px">
<p class="ml-2">1,034 Questions</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-2">
</div>
</div>
</body>
I am using bootstrap card to show list of videos and for videos i am using YouTube Video thumbnail (hqdefault.jpg). since this thumbnail show black strip on top and bottom on the image which i want to hide as it doesn't look good.
i tried .card-img-top{position:absolute; top:-30px; } but it breaks the whole design
https://codepen.io/KGuide/pen/MWyZYyb?editors=0100
<div class="container py-5">
<div class="row pb-5 mb-4">
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0"><img src="https://img.youtube.com/vi/Aymrnzianf0/hqdefault.jpg" alt="" class="w-100 card-img-top">
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0"><img src="https://img.youtube.com/vi/EMVPpPE_Bx4/hqdefault.jpg" alt="" class="w-100 card-img-top">
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0"><img src="https://img.youtube.com/vi/22BXPLkyocw/hqdefault.jpg" alt="" class="w-100 card-img-top">
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0"><img src="https://img.youtube.com/vi/Aymrnzianf0/hqdefault.jpg" alt="" class="w-100 card-img-top">
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
</div>
</div>
overflow hidden with margin negative % is best solution:
body {
min-height: 100vh;
background: #fafafa;
}
.social-link {
width: 30px;
height: 30px;
border: 1px solid #ddd;
display: flex;
align-items: center;
justify-content: center;
color: #666;
border-radius: 50%;
transition: all 0.3s;
font-size: 0.9rem;
}
.social-link:hover, .social-link:focus {
background: #ddd;
text-decoration: none;
color: #555;
}
.progress {
height: 10px;
}
.card-body {
overflow: hidden;
}
/* update: */
.photo {
overflow: hidden;
}
.photo img {
margin: -10% 0 -10% 0;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container py-5">
<div class="row pb-5 mb-4">
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0">
<div class="photo">
<img src="https://img.youtube.com/vi/Aymrnzianf0/hqdefault.jpg" alt="" class="w-100 card-img-top">
</div>
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0">
<div class="photo">
<img src="https://img.youtube.com/vi/EMVPpPE_Bx4/hqdefault.jpg" alt="" class="w-100 card-img-top">
</div>
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0">
<div class="photo">
<img src="https://img.youtube.com/vi/22BXPLkyocw/hqdefault.jpg" alt="" class="w-100 card-img-top">
</div>
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0">
<div class="photo">
<img src="https://img.youtube.com/vi/Aymrnzianf0/hqdefault.jpg" alt="" class="w-100 card-img-top">
</div>
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
</div>
</div>
You can try this by adding a background image
.bg {
height: 235px;
background-position: center;
background-position-x: inherit;
background-repeat: no-repeat;
background-size: 100% 134%;
background-position: center;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container py-5">
<div class="row pb-5 mb-4">
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0">
<div style="background-image: url('https://img.youtube.com/vi/Aymrnzianf0/hqdefault.jpg');" alt="" class="w-100 card-img-top bg">
</div>
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0">
<div style="background-image: url('https://img.youtube.com/vi/EMVPpPE_Bx4/hqdefault.jpg');" alt="" class="w-100 card-img-top bg">
</div>
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0">
<div style="background-image: url('https://img.youtube.com/vi/22BXPLkyocw/hqdefault.jpg');" alt="" class="w-100 card-img-top bg">
</div>
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0">
<div style="background-image: url('https://img.youtube.com/vi/Aymrnzianf0/hqdefault.jpg');" alt="" class="w-100 card-img-top bg">
</div>
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
</div>
</div>
Here is two things that you can do:
Override bootstraps col and row classes, which means play around with the height until you get the image to be 1280x720 (normal youtube thumbnail dimension)
(Recommended). You can make your own rows and cols by using grid-template-areas. Which is a very powerful css property that simply lets you write out your layout.
grid-template-areas: 'youtube_video youtube_video youtube_video';
It is a simple css property that is very easy to learn and also very powerful.
check out grid-template-areas on the tryit editor
After you make your own col and row don't forget to make the image width and height:
1280 x 720
I have tried 2 way but I see margin top and bottom also good.
clip-path: polygon(0 13%, 100% 13%, 100% 87%, 0 87%);
clip-path will crop the top and bottom portion.
Another one is using background.
body {
min-height: 100vh;
background: #fafafa;
}
.social-link {
width: 30px;
height: 30px;
border: 1px solid #ddd;
display: flex;
align-items: center;
justify-content: center;
color: #666;
border-radius: 50%;
transition: all 0.3s;
font-size: 0.9rem;
}
.social-link:hover, .social-link:focus {
background: #ddd;
text-decoration: none;
color: #555;
}
.progress {
height: 10px;
}
.card-img-top{
background: var(--i) no-repeat;
background-position: center;
background-size: 100% 140%;
display: block;
min-height: 250px;
width: 100%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container py-5">
<div class="row pb-5 mb-4">
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0"><img src="" style="--i:url(https://img.youtube.com/vi/Aymrnzianf0/hqdefault.jpg)" alt="" class="w-100 card-img-top">
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0">
<img src="" style="--i:url(https://img.youtube.com/vi/EMVPpPE_Bx4/hqdefault.jpg)" alt="" class="w-100 card-img-top">
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0"><img src="" style="--i:url(https://img.youtube.com/vi/22BXPLkyocw/hqdefault.jpg)" alt="" class="w-100 card-img-top">
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mb-4 mb-lg-0">
<!-- Card-->
<div class="card shadow-sm border-0 rounded">
<div class="card-body p-0"><img src="" style="--i:url(https://img.youtube.com/vi/Aymrnzianf0/hqdefault.jpg)" alt="" class="w-100 card-img-top">
<div class="p-4">
<h5 class="mb-0">Mark Rockwell</h5>
<p class="small text-muted">CEO - Consultant</p>
</div>
</div>
</div>
</div>
</div>
</div>
Attached screenshot of code
What I have done is, wrap your img into one figure tag and then gave height to the figure tag. Then on image give height 100% and object-fit cover. Black bg will automatically hide.
<figure>
<img src="https://img.youtube.com/vi/Aymrnzianf0/hqdefault.jpg" alt=""
class="w-100 card-img-top">
</figure>
figure {
margin: 0;
height: 284px;
border: 1px solid red;
}
figure img {
height: 100%;
object-fit: cover;
}
I want a banner like this:
When it is displayed in mobile
When it is displayed in desktop
For that I tried:
.card-body {
display: flex;
}
#media(min-width:768px) {
.card-title {
font-size: 3vw;
word-break: break-all;
}
}
#media(max-width:767px) {
.card-title {
font-size: 8.5vw;
word-break: break-all;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="shadow card col-md-3 ml-4 mt-3 mb-3 mr-4" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="90">
<h5 class="card-title float-right">9999999999</h5>
</div>
<div class="card-body col-12 border p-0">
Get Details
</div>
</div>
</div>
But in the code above, the text is aligned left, but I am using float-right.
Use margin-left: auto
.card-body {
display: flex;;
}
.card-title {
margin-left: auto;
}
h5 {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
#media(min-width:768px) {
.card-title {
font-size: 3vw;
word-break: break-all;
}
}
#media(max-width:767px) {
.card-title {
font-size: 8.5vw;
word-break: break-all;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="shadow card col-md-3 ml-4 mt-3 mb-3 mr-4" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="90">
<h5 class="card-title float-right">99999952341624624629999</h5>
</div>
<div class="card-body col-12 border p-0">
Get Details
</div>
</div>
</div>
You can achieve this with existing bootstrap-4 class changes
changes ml-4 to ml-sm-4 and add new class ml-auto to card-title div
<div class="shadow card col-md-3 ml-sm-4 mt-3 mb-3 mr-4" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="90">
<h5 class="card-title ml-auto">9999999999</h5>
</div>
<div class="card-body col-12 border p-0">
Get Details
</div>
</div>
</div>
I'm trying to list side by side an anime list with images and name on a card, but the DIV ends and the image ignores and continues, how can I solve this?
URL: Here
Image: The image
css:
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
min-width: 199px;
max-width: 200px;
float:left;
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-left:5px;
margin-top:10px;
}
HTML:
<div class="container">
<div class="card">
<button class="btn btn-success add" onclick="novoEpisodio(85)"><span class="fa fa-plus"></span> Adicionar Episódio</button>
<img onclick="escolherAnime(85)" src="https://4.bp.blogspot.com/-TYMOypUwSGI/WcqOASxepZI/AAAAAAAAK2w/-_V0RHPcEj8d0IO79AyUf2oUFTRRa3TjgCLcBGAs/s1600/Black-Clover-anime-poster-visual-v1.jpg" style="min-width:199px; max-width:200px; min-height:299px; max-height: 300px;">
<div class="container">
<h4><b>Black Clover</b>
</h4>
</div>
</div>
First of all, you're site's Bootstrap version is out of date with the HTML syntax you're using. Cards replaced panels from Bootstrap 3. You're using Bootstrap 3, view here which uses panels.
A lot of things changed between Bootstrap 3 and 4. I highly recommend you go with Bootstrap 4. Additionally, your HTML syntax doesn't line up with the traditional layout.
container > row > column > card
Here is a Codepen you can fork and play with.
Here is an example of what you need using Bootstrap 4.
/* Roboto Font */
#import url('https://fonts.googleapis.com/css?family=Roboto');
html, body {
height: 100%;
}
body {
font-family: 'Roboto', sans-serif;
}
/* Custom CSS */
.text-strong {
font-weight: bold;
}
.card-body {
padding: .5rem;
}
.card-title {
margin: 0;
}
.card {
border: 2px dashed black;
box-shadow: 0px 10px 20px rgba(150,150,150,.5);
}
.card:hover {
box-shadow: 0px 10px 20px rgba(60, 141, 188,0.5);
}
<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
<script src='https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.min.js'></script>
<div class="container-fluid p-5">
<div class="row no-gutters">
<div class="col-sm-12 col-md-3 col-lg-2 d-flex align-items-stretch mb-2">
<div class="card">
<img class="card-img-top" src="https://www.anitube.site/wp-content/uploads/Bleach-dub.jpg">
<div class="card-body">
<h5 class="card-title text-strong">Bleach</h5>
</div>
</div>
</div>
<div class="col-sm-12 col-md-3 col-lg-2 d-flex align-items-stretch mb-2">
<div class="card">
<img class="card-img-top" src="https://www.anitube.site/wp-content/uploads/Bleach-dub.jpg">
<div class="card-body">
<h5 class="card-title text-strong">Black Clover</h5>
</div>
</div>
</div>
<div class="col-sm-12 col-md-3 col-lg-2 d-flex align-items-stretch mb-2">
<div class="card">
<img class="card-img-top" src="https://www.anitube.site/wp-content/uploads/Bleach-dub.jpg">
<div class="card-body">
<h5 class="card-title text-strong">Boku dake ga in...</h5>
</div>
</div>
</div>
<div class="col-sm-12 col-md-3 col-lg-2 d-flex align-items-stretch mb-2">
<div class="card">
<img class="card-img-top" src="https://www.anitube.site/wp-content/uploads/Bleach-dub.jpg">
<div class="card-body">
<h5 class="card-title text-strong">Dragon Ball Super</h5>
</div>
</div>
</div>
<div class="col-sm-12 col-md-3 col-lg-2 d-flex align-items-stretch mb-2">
<div class="card">
<img class="card-img-top" src="https://www.anitube.site/wp-content/uploads/Bleach-dub.jpg">
<div class="card-body">
<h5 class="card-title text-strong">Nanatsu no Taizai</h5>
</div>
</div>
</div>
<div class="col-sm-12 col-md-3 col-lg-2 d-flex align-items-stretch mb-2">
<div class="card">
<img class="card-img-top" src="https://www.anitube.site/wp-content/uploads/Bleach-dub.jpg">
<div class="card-body">
<h5 class="card-title text-strong">Naruto Shippuden</h5>
</div>
</div>
</div>
</div>
</div>