Bootstrap is being used, and there is a div with col-xs-12, col-sm-6, col-md-4 classes.
Task :
- To add a clear on every 1 item for col-xs-12,
add a clear on every 2 items for col-sm-6,
and clear on every 3rd item for col-md-4.
The current code only seems to clear on every 1 item.
/* Extra Small Devices, Phones */
@media only screen and (min-width : 480px) {
.video-item:nth-child(1n+1){
clear:left
}
}
/* Small Devices, Tablets */
@media only screen and (min-width : 768px) {
.video-item:nth-child(2n+1){
clear:left
}
}
/* Medium Devices, Desktops */
@media only screen and (min-width : 992px) {
.video-item:nth-child(3n+1){
clear:left
}
}
<div class="video-item col-sm-6 col-xs-12 col-md-4 img-sec">
Box
</div>
HTML STRUCTURE:
<div id="video-page" >
<div class="container">
<h2><center>Video Library</center></h2>
<div class="span12 details">
{% for article in blogs.videos.articles reversed %}
{% include 'iframevideoid', video_url:{{article.content | strip| strip_html}} %}
<div class="video-item col-sm-6 col-xs-12 col-md-4 img-sec">
<div class="kind">
<a class="open-popup" data-target="#myModal" data-toggle="modal" data-video-id="{{videoid}}" >
<!-- {{ article.image.src | img_url: 'large'| img_tag: 'Video', 'img-responsive' }} -->
<img src="https://img.youtube.com/vi/{{videoid}}/mqdefault.jpg" alt="Video" class="img-responsive">
</a>
<p class="para">
<a data-target="#myModal" data-toggle="modal" data-video-id="{{videoid}}">
<h3 class="pare-head">{{ article.title }}</h3>
</a>
</p>
</div>
</div>
{% endfor %}
</div>
<!-- Modal -->
{%include 'modal-video' %}
</div>
</div>