I am working with a container div that houses several nested divs. Here is the CSS code for the structure:
.result-container {
max-width: 650px;
margin: 0 auto;
background: blue;
border: 1px solid;
position: relative;
text-align: center;
}
.result-container .item {
display: inline-block;
max-width: 200px;
min-width: 200px;
background: green;
border: 1px solid;
}
.result-container .item img {
display: block;
margin: 0 auto;
}
<div class="result-container">
<div class="item">
<img src="http://devimg.com/150x150" width="150" height="150">
</div>
<div class="item">
<img src="http://devimg.com/150x150" width="150" height="150">
</div>
<div class="item">
<img src="http://devimg.com/150x150" width="150" height="150">
</div>
<div class="item">
<img src="http://devimg.com/150x150" width="150" height="150">
</div>
<div class="item">
<img src="http://devimg.com/150x150" width="150" height="150">
</div>
<div class="item">
<img src="http://devimg.com/150x150" width="150" height="150">
</div>
<div class="item">
<img src="http://devimg.com/150x150" width="150" height="150">
</div>
<div class="item">
<img src="http://devimg.com/150x150" width="150" height="150">
</div>
</div>
The parent div utilizes the 'text-align: center' property to center align the child divs, but I am not satisfied with how the last row appears.
https://i.sstatic.net/exUe9.png
I am looking for a way to achieve the layout depicted in the image below:
https://i.sstatic.net/TMdUf.png
If I were to use 'display: table', would that be considered a good practice? I appreciate any guidance you can provide.