I have a row with two columns, where Column 1 currently contains 7 list items under the ul
tag.
However, I want to display only 5 list items in Column 1 and automatically move the remaining items to the next column (i.e., Column 2).
Is there a way to achieve this dynamic movement of list items to the next column based on a count (e.g., 5) using only HTML and CSS, without any third-party libraries like jQuery?
Current Snippet:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-xs-4 mr-4">
<ul class="list-group">
<li class="list-group-item">List Item 1</li>
<li class="list-group-item">List Item 2</li>
<li class="list-group-item">List Item 3</li>
<li class="list-group-item">List Item 4</li>
<li class="list-group-item">List Item 5</li>
<li class="list-group-item">List Item 6</li>
<li class="list-group-item">List Item 7</li>
</ul>
</div>
<div class="col-xs-4 mr-4">
Column-2
</div>
</div>
</div>
Expected Result:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-xs-4 mr-4">
<ul class="list-group">
<li class="list-group-item">List Item 1</li>
<li class="list-group-item">List Item 2</li>
<li class="list-group-item">List Item 3</li>
<li class="list-group-item">List Item 4</li>
<li class="list-group-item">List Item 5</li>
</ul>
</div>
<div class="col-xs-4 mr-4">
<ul class="list-group">
<li class="list-group-item">List Item 6</li>
<li class="list-group-item">List Item 7</li>
</ul>
</div>
</div>
</div>