@tuanphan wow, so glad I stumbled across this! I've been trying to figure out how to do this with mine as well! Tried using some of the code above, but wasn't able to get it to work. I already have some other custom code in there so I wasn't sure if I just start on a new line after a closing "}"?
Basically would love my site to display a few images side-by-side (or whatever fits to make the grid) kinda like on a desktop. But the mobile version of squarespace just automatically stacks them.