Using the latest version of Bootstrap, I am trying to create an unordered list that displays images in a grid-like format:
<div id="featured-products" class="container">
<ul>
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
</ul>
</div>
To center the unordered list, I have used text-align: center
:
ul {
list-style-type: none;
text-align: center;
margin-bottom: 0px;
padding-left: 0;
padding-right: 0;
}
li {
display: inline;
padding-left: 0px;
padding-right: 10px;
}
The issue arises when the last row is not aligned properly to the left if it is incomplete, meaning a list item is missing.
Is there a solution to align the last row to the left while keeping the unordered list centered within the container? And this solution should be responsive as well.