You can set display: table
on the outer divs, then use display: table-cell
on the inner elements. This gets rid of that white/black line flickering: demo
You may need to refactor your code if you need to flow the images to multiple lines when the browser is at different sizes.