I want to have multiple cards next to each other (preferebly 10), but the webpage only shows 6 at most.
Here is the css:
#media (min-width: 576px) {
/* line 256, node_modules/bootstrap/scss/_card.scss */
.card-columns2 {
-webkit-column-count: 7;
column-count: 7;
-moz-column-count: 7;
-webkit-column-gap: 1.25rem;
column-gap: 1.25rem;
-moz-column-count: 1.25rem;
width: 100%;
orphans: 1;
widows: 1;}
/* line 267, node_modules/bootstrap/scss/_card.scss */
.card-columns2 .card {
display: inline-block;
width: 100%;
} }
And here is the snippet of the HTML code:
<div class="mb-4 container-fluid" >
<div class="row" >
<div class="card-columns2">
<div class="card card-pin">
<img class="card-img" src="https://snipp" alt="#1481">
<div class="text-block" >
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
<div class="card card-pin">
<img class="card-img" src="snipp" alt="#1546">
<div class="text-block" >
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
And that's how it looks like with column count of 7:
enter image description here
It looks the same for the count of 10, but with smaller boxes.
#media (min-width: 576px) {
/* line 256, node_modules/bootstrap/scss/_card.scss */
.card-columns2 {
-webkit-column-count: 10;
column-count: 10;
-moz-column-count: 10;
-webkit-column-gap: 1.25rem;
column-gap: 1.25rem;
-moz-column-count: 1.25rem;
width: 100%;
orphans: 1;
widows: 1;}
/* line 267, node_modules/bootstrap/scss/_card.scss */
.card-columns2 .card {
display: inline-block;
width: 100%;
padding: 0 15px;
} }
<div class="mb-4 container-fluid">
<div class="row">
<div class="card-columns2">
<div class="card card-pin">
<img class="card-img" src="https://via.placeholder.com/200x200.jpg?text=irtiza" alt="#1481">
<div class="text-block">
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
<div class="card card-pin">
<img class="card-img" src="https://via.placeholder.com/200x200.jpg?text=irtiza" alt="#1546">
<div class="text-block">
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div
</div>
<div class="card card-pin">
<img class="card-img" src="https://via.placeholder.com/200x200.jpg?text=irtiza" alt="#1546">
<div class="text-block">
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
<div class="card card-pin">
<img class="card-img" src="https://via.placeholder.com/200x200.jpg?text=irtiza" alt="#1481">
<div class="text-block">
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
<div class="card card-pin">
<img class="card-img" src="https://via.placeholder.com/200x200.jpg?text=irtiza" alt="#1546">
<div class="text-block">
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
<div class="card card-pin">
<img class="card-img" src="https://via.placeholder.com/200x200.jpg?text=irtiza" alt="#1481">
<div class="text-block">
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
<div class="card card-pin">
<img class="card-img" src="https://via.placeholder.com/200x200.jpg?text=irtiza" alt="#1546">
<div class="text-block">
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
<div class="card card-pin">
<img class="card-img" src="https://via.placeholder.com/200x200.jpg?text=irtiza" alt="#1481">
<div class="text-block">
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
<div class="card card-pin">
<img class="card-img" src="https://via.placeholder.com/200x200.jpg?text=irtiza" alt="#1546">
<div class="text-block">
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
<div class="card card-pin">
<img class="card-img" src="https://via.placeholder.com/200x200.jpg?text=irtiza" alt="#1546">
<div class="text-block">
</div>
<div class="overlay">
<h2 class="card-title title"></h2>
<div class="more">
<a href="post.html">
<i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> More </a>
</div>
</div>
</div>
</div>
</div>
</div>
The only change you need to update your css, -webkit-column-count: 10; in all where you use column count.
thanks
Related
I am trying to extend the last card-footer to fill the rest of the space if it doesn't have any buttons. I am tried a number of flex combinations without much luck.
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-4 mb-4">
<div class="card">
<div class="card-header text-center">
<span data-bind="html: TimeFormatted">8:00 AM EST</span>, <span class="venue" data-bind="text: Venue">JB Red Owens, Field 1</span>
</div>
<div class="card-body">
<div class="d-flex">
<div class="text-truncate mr-auto">
<span data-bind="text: AwayTeamName">(A1)</span><span style="display: none;">*</span>
</div>
<div>
<span class="final-score">4</span>
</div>
</div>
<div class="d-flex">
<div class="text-truncate mr-auto">
<span data-bind="text: HomeTeamName">(A2)</span><span style="display: none;">*</span>
</div>
<div>
<span class="final-score">5</span>
</div>
</div>
</div>
<div class="card-footer d-flex">
<div class="text-truncate mr-auto"><span>8U</span>, <span>Pool A</span></div>
<div class="">Final</div>
</div>
<div class="card-footer text-center">
<a target="_blank" title="" href="http://maps.apple.com/maps?daddr=34.8043103,-82.5869584" class="btn btn-sm btn-dark"><i class="fa fa-map-marker"></i> Venue</a>
</div>
</div>
</div>
<div class="col-4">
<div class="card">
<div class="card-header text-center">
<span data-bind="html: TimeFormatted">8:00 AM EST</span>, <span class="venue" data-bind="text: Venue">JB Red Owens, Field 1</span>
</div>
<div class="card-body">
<div class="d-flex">
<div class="text-truncate mr-auto">
<span data-bind="text: AwayTeamName">(A1)</span><span style="display: none;">*</span>
</div>
<div>
<span class="final-score">4</span>
</div>
</div>
<div class="d-flex">
<div class="text-truncate mr-auto">
<span data-bind="text: HomeTeamName">(A2)</span><span style="display: none;">*</span>
</div>
<div>
<span class="final-score">5</span>
</div>
</div>
</div>
<div class="card-footer d-flex">
<div class="text-truncate mr-auto"><span>8U</span>, <span>Pool A</span></div>
<div class="">Final</div>
</div>
<div class="card-footer text-center">
<a target="_blank" title="" href="http://maps.apple.com/maps?daddr=34.8043103,-82.5869584" class="btn btn-sm btn-dark"><i class="fa fa-map-marker"></i> Venue</a>
</div>
</div>
</div>
<div class="col-4">
<div class="card">
<div class="card-header text-center">
<span data-bind="html: TimeFormatted">8:00 AM EST</span>, <span class="venue" data-bind="text: Venue">JB Red Owens, Field 1</span>
</div>
<div class="card-body">
<div class="d-flex">
<div class="text-truncate mr-auto">
<span data-bind="text: AwayTeamName">(A1)</span><span style="display: none;">*</span>
</div>
<div>
<span class="final-score">4</span>
</div>
</div>
<div class="d-flex">
<div class="text-truncate mr-auto">
<span data-bind="text: HomeTeamName">(A2)</span><span style="display: none;">*</span>
</div>
<div>
<span class="final-score">5</span>
</div>
</div>
</div>
<div class="card-footer d-flex">
<div class="text-truncate mr-auto"><span>8U</span>, <span>Pool A</span></div>
<div class="">Final</div>
</div>
<div class="card-footer text-center">
</div>
</div>
</div>
</div>
You could try the following (a part of the solution was retrieved from this answer):
.card {
height: 100%;
}
.card-body {
flex: 0 1 auto !important;
}
.card-footer.text-center {
flex: 1;
}
I have created a small fiddle showing the result:
I'm having a hard time targetting the second <img> tag to apply a .css rule to it but it's not working:
This is my code:
.product-highlights img:nth-of-type(2) {
margin: 0 4px;
}
<div class="product-highlights">
<div class="grid-container full">
<div class="grid-x">
<div class="cell small-4">
<a href="#">
<img src="http://via.placeholder.com/350x150" alt="Discounts">
</a>
</div>
<div class="cell small-4">
<a href="#">
<img src="http://via.placeholder.com/350x150" alt="Discounts">
</a>
</div>
<div class="cell small-4">
<a href="#">
<img src="http://via.placeholder.com/350x150" alt="Discounts">
</a>
</div>
</div>
</div>
</div>
What am I doing wrong?
As I noted in my comment above, nth-of-type only looks at siblings, so in your case target the image's parent divs instead:
.product-highlights .cell:nth-of-type(2) img{
margin: 0 4px;
}
<div class="product-highlights">
<div class="grid-container full">
<div class="grid-x">
<div class="cell small-4">
<a href="#">
<img src="http://via.placeholder.com/350x150" alt="Discounts">
</a>
</div>
<div class="cell small-4">
<a href="#">
<img src="http://via.placeholder.com/350x150" alt="Discounts">
</a>
</div>
<div class="cell small-4">
<a href="#">
<img src="http://via.placeholder.com/350x150" alt="Discounts">
</a>
</div>
</div>
</div>
</div>
pick secound div that holding image and then apply css to that image
.product-highlights .cell:nth-child(2) img{
margin: 0 4px;
}
<div class="product-highlights">
<div class="grid-container full">
<div class="grid-x">
<div class="cell small-4">
<a href="#">
<img src="http://via.placeholder.com/350x150" alt="Discounts">
</a>
</div>
<div class="cell small-4">
<a href="#">
<img src="http://via.placeholder.com/350x150" alt="Discounts">
</a>
</div>
<div class="cell small-4">
<a href="#">
<img src="http://via.placeholder.com/350x150" alt="Discounts">
</a>
</div>
</div>
</div>
</div>
I have a container with a row and inside that six portfolios items.
This code when used on a small screen I get the following result:
1st line : 2 images
2nd line : 1 image on the right side
3rd line : 2 images
4th line : 1 image on the left side
Anyone got a clue? Seems like a bug to me.
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb">
<img src="images/portfolio-img1.png" alt="image" class="img-responsive">
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb">
<img src="images/portfolio-img2.png" alt="image" class="img-responsive">
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb">
<img src="images/portfolio-img3.png" alt="image" class="img-responsive">
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb">
<img src="images/portfolio-img4.png" alt="image" class="img-responsive">
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb">
<img src="images/portfolio-img1.png" alt="image" class="img-responsive">
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb">
<img src="images/portfolio-img1.png" alt="image" class="img-responsive">
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
</div>
</div>
</div>
This is due to the different height of each post image, to avoid this use same size images or set the height of your <div class="col-md-4 col-sm-6 col-xs-12">...</div> similar to each other.
You can use the background-image property instead of just using <img> on the <div>.
Solution:
.portfolio-thumb {
width: 300px;
height: 200px;
background-size: cover;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb" style="background-image: url('http://placehold.it/300x200');"></div>
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb" style="background-image: url('http://placehold.it/300x200');"></div>
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb" style="background-image: url('http://placehold.it/300x200');"></div>
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb" style="background-image: url('http://placehold.it/300x200');"></div>
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb" style="background-image: url('http://placehold.it/300x200');"></div>
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="portfolio-thumb" style="background-image: url('http://placehold.it/300x200');"></div>
<div class="portfolio-overlay">
<h2>Project One</h2>
<a href="#">
<i class="fa fa-search"></i>
</a>
</div>
</div>
</div>
</div>
Hope this helps!
I`m having problems with Bootstrap grid nesting in a project. I've created a div with a grid of 12 and a class with a background image.
After that, I created 3 other grids, one of 3 other with 8 and the last one with 1, for a total of 12. However, when I duplicate it, it doesn`t go to the next line as supposed to..
The link to see it is: https://www.neevasoft.com/test/saude.html
The code is here:
<article id="blog-list" class="blog-list article3 gradient-7">
<div class="container">
<div class="row">
<h2 class="title text-center">Saúde</h2>
<div class="item col-md-12 col-sm-12 col-xs-12">
<div class="item1 col-md-3 col-sm-3 col-xs-3">
<figure class="figure-wrapper">
<a href="interno.html">
<img class="img-responsive2" src="assets/images/blog/blog-1.jpg" alt="">
</a>
</figure>
</div>
<div class="item2 col-md-8 col-sm-8 col-xs-8">
<figure class="figure-wrapper">
<a href="interno.html">
Espaço Corporal Eloiza Bovió
</a>
</figure>
</div>
<div class="item3 col-md-1 col-sm-1 col-xs-1">
<figure class="figure-wrapper">
<a href="interno.html">
<i class="fa fa-angle-right" aria-hidden="true"></i>
</a>
</figure>
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<figure class="figure-wrapper">
<a href="interno.html">
<img class="img-responsive2" src="assets/images/blog/blog-1.jpg" alt="">
</a>
</figure>
</div>
<div class="col-md-8 col-sm-8 col-xs-8">
<figure class="figure-wrapper">
<a href="interno.html">
Espaço Corporal Eloiza Bovió
</a>
</figure>
</div>
<div class="col-md-1 col-sm-1 col-xs-1">
<figure class="figure-wrapper">
<a href="interno.html">
<i class="fa fa-angle-right" aria-hidden="true"></i>
</a>
</figure>
</div>
</div><!--//row-->
</div><!--//container-->
</article>
You should not be nesting col-* divs
Try using this:
<article id="blog-list" class="blog-list article3 gradient-7">
<div class="container">
<div class="row">
<h2 class="title text-center">Saúde</h2>
<div class="item1 col-md-3 col-sm-3 col-xs-3">
<figure class="figure-wrapper">
<a href="interno.html">
<img class="img-responsive" src="http://lorempixel.com/400/200/" alt="">
</a>
</figure>
</div>
<div class="item2 col-md-8 col-sm-8 col-xs-8">
<figure class="figure-wrapper">
<a href="interno.html">
Espaço Corporal Eloiza Bovió
</a>
</figure>
</div>
<div class="item3 col-md-1 col-sm-1 col-xs-1">
<figure class="figure-wrapper">
<a href="interno.html">
<i class="fa fa-angle-right" aria-hidden="true"></i>
</a>
</figure>
</div>
</div><!--//row-->
<div class="row">
<div class="col-md-3 col-sm-3 col-xs-3">
<figure class="figure-wrapper">
<a href="interno.html">
<img class="img-responsive" src="http://lorempixel.com/400/200/" alt="">
</a>
</figure>
</div>
<div class="col-md-8 col-sm-8 col-xs-8">
<figure class="figure-wrapper">
<a href="interno.html">
Espaço Corporal Eloiza Bovió
</a>
</figure>
</div>
<div class="col-md-1 col-sm-1 col-xs-1">
<figure class="figure-wrapper">
<a href="interno.html">
<i class="fa fa-angle-right" aria-hidden="true"></i>
</a>
</figure>
</div>
</div>
</div><!--//container-->
This is how I managed to fix it
<article id="blog-list" class="blog-list article3 gradient-7">
<div class="container">
<div class="row">
<h2 class="title text-center">Saúde</h2>
<div class="item col-xs-12">
<div class="col-xs-12">
<div class="item1 col-xs-3">
<figure class="figure-wrapper">
<img class="img-responsive2" src="assets/images/blog/blog-1.jpg" alt="">
</figure>
</div>
<div class="item2 col-xs-8">
<figure class="figure-wrapper">
Espaço Corporal Eloiza Bovió
</figure>
</div>
<div class="item3 col-xs-1">
<figure class="figure-wrapper">
<i class="fa fa-angle-right" aria-hidden="true"></i>
</figure>
</div>
</div>
<div class="col-xs-12">
<div class="item1 col-xs-3">
<figure class="figure-wrapper">
<img class="img-responsive2" src="assets/images/blog/blog-1.jpg" alt="">
</figure>
</div>
<div class="item2 col-xs-8">
<figure class="figure-wrapper">
Espaço Corporal Eloiza Bovió
</figure>
</div>
<div class="item3 col-xs-1">
<figure class="figure-wrapper">
<i class="fa fa-angle-right" aria-hidden="true"></i>
</figure>
</div>
</div>
</div>
</div><!--//row-->
</div><!--//container-->
So I built this "testimonial" slider on my website using bootstrap's carousel plugin but for some reason the movement seems clunky when it changes slides.. I'm not sure if it's my doing on the CSS because I styled on top of some of the elements and I don't really know too much of CSS..
Anyway, here's my code:
HTML
<div class="container-fluid">
<div class="row testimonials">
<div class="container">
<div class="row">
<div class="col-md-12">
<h3 class="text-center">Testimonials</h3>
</div>
</div>
<div class="carousel slide" id="testimonial_slider" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#testimonial_slider" data-slide-to="0" class="active"></li>
<li data-target="#testimonial_slider" data-slide-to="1"></li>
<li data-target="#testimonial_slider" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="row item active">
<div class="col-md-6 testimonial">
<img src="my-image-url.jpg">
<p><i class="fa fa-quote-left"></i> The content</p>
<span>The Title</span>
</div>
<div class="col-md-6 testimonial">
<img src="my-image-url.jpg">
<p><i class="fa fa-quote-left"></i> The content</p>
<span>The Title</span>
</div>
</div>
<div class="row item active">
<div class="col-md-6 testimonial">
<img src="my-image-url.jpg">
<p><i class="fa fa-quote-left"></i> The content</p>
<span>The Title</span>
</div>
<div class="col-md-6 testimonial">
<img src="my-image-url.jpg">
<p><i class="fa fa-quote-left"></i> The content</p>
<span>The Title</span>
</div>
</div>
<div class="row item active">
<div class="col-md-6 testimonial">
<img src="my-image-url.jpg">
<p><i class="fa fa-quote-left"></i> The content</p>
<span>The Title</span>
</div>
<div class="col-md-6 testimonial">
<img src="my-image-url.jpg">
<p><i class="fa fa-quote-left"></i> The content</p>
<span>The Title</span>
</div>
</div>
</div>
</div>
</div>
</div>
And the CSS:
.testimonials {
padding-bottom:30px;
}
.testimonial {
position:relative;
height:100px;
margin:10px 0 20px 0;
padding:0 20px 20px 120px;
box-sizing:border-box;
}
.testimonial p i {
color:#eb7022;
}
.testimonial span {
position:absolute;
bottom:0;
left:130px;
}
.testimonial img {
height:100px;
width:100px;
margin-right:120px;
border-radius:6px;
position:absolute;
top:0;
left:16px;
}
You can also see it live here.
Am I breaking something with these styles?
Any help appreciated, thanks!
Don't use .row with .item.
Apply .active class only to first item.
Instead of this:
<div class="row item active">
<div class="col-md-6 testimonial">
<img src="1.jpg">
<p><i class="fa fa-quote-left"></i> The content</p>
<span>The Title</span>
</div>
<div class="col-md-6 testimonial">
<img src="1.jpg">
<p><i class="fa fa-quote-left"></i> The content</p>
<span>The Title</span>
</div>
</div>
Use this:
<div class="item active">
<div class="row>
<div class="col-md-6 testimonial">
<img src="1.jpg">
<p><i class="fa fa-quote-left"></i> The content</p>
<span>The Title</span>
</div>
<div class="col-md-6 testimonial">
<img src="1.jpg">
<p><i class="fa fa-quote-left"></i> The content</p>
<span>The Title</span>
</div>
</div>
</div>