I am looking to implement a horizontal scroll (for small screens only) within my card layout so that all cards are displayed in a single row. Here is an example:
For small screens: https://i.sstatic.net/5eWyV.png So far, I have added horizontal scrolling to the container-fluid (card layout), but the cards are appearing in a single row.
@media (max-width: 600px) {
.container-fluid-flexbox {
margin-top: 300px;
margin-left: 0px;
margin-right: 0px;
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
width: 500px;
}
.card {
width: 10px;
flex: 0 0 auto;
}
}
@media (max-width: 800px) {
.container-fluid {
margin-top: 350px;
margin-left: 0px;
margin-right: 0px;
}
.card {
display: inline-block;
width: 100%;
}
}
.container-fluid{
margin-top: 100px;
margin-left: 50px;
margin-right: 50px;
overflow-x: scroll;
overflow-y: hidden;
white-space: nowrap;
}
.card-reveal{
color: #ffffff;
background-color: rgba(0,0,0,0.7) !important;
}
div.card-reveal span.card-title{
color: #ffffff !important;
}
.card {
width: 280px;
height: 360px;
z-index: 5;
}
#card-img {
height: 200px;
}
.card-content {
margin-top: -17px;
color: black;
}
.card-action {
margin-top: 38px;
}
.card-button {
margin-left: -1px;
margin-top: -7px;
}
<div class="container-fluid" style="background-color: black">
<div class="row">
<div class="col xl3">
<div class="card hover-reveal sticky-action z-depth-2">
<div class="card-image waves-effect waves-block waves-light">
<img id="card-img" class="activator" src="http://images.media-allrecipes.com/userphotos/720x405/1889670.jpg">
</div>
<div class="card-content">
<p><a href="#">Card Title</a><i class="material-icons right">more_vert</i></p>
</div>
<div class="card-action">
<a href="#!" id="card-parti" class="btn waves-effect waves-teal">VIEW</a>
</div>
<div class="card-reveal">
<span class="card-title grey-text text-darken-4">Card Title<i class="material-icons right">close</i></span>
<p>Here is some more information about this product that is only revealed once clicked on.</p>
</div>
</div>
</div>
<div class="col xl3">
<div class="card hover-reveal sticky-action z-depth-2">
<div class="card-image waves-effect waves-block waves-light">
<img id="card-img" class="activator" src="http://images.media-allrecipes.com/userphotos/720x405/1889670.jpg">
</div>
<div class="card-content">
<p><a href="#">Card Title</a><i class="material-icons right">more_vert</i></p>
</div>
<div class="card-action">
<a href="#!" id="card-parti" class="btn waves-effect waves-teal">VIEW</a>
</div>
<div class="card-reveal">
<span class="card-title grey-text text-darken-4">Card Title<i class="material-icons right">close</i></span>
<p>Here is some more information about this product that is only revealed once clicked on.</p>
</div>
</div>
</div>
</div>
</div>