Of course, imga img { width: 50%;}
is indispensable. Both css and js are needed here.
I suggest you take a look at freewall .
This is a cross-browser responsive Jquery
plugin that helps you create many different types of grid layouts: flexible layout, photo layout, embedded layouts, metro style, like pinterest and other types. It uses CSS3
animation. This plugin is a good solution for dynamically creating a grid layout for both desktop and mobile versions and tablet versions.
plugin home page
If he is not satisfied, then in the search for javascript photo brick
you can, I think, find something else suitable for you, for example
http://masonry.desandro.com/
http://callmecavs.com/bricks.js/
and much more.
jquery
plugin for images in the form of bricks .......... or search for ajavascript photo brick
request that will issue masonry.desandro.com , callmecavs .com / bricks.js and many other plugins - Alexey Shimansky