To adjust the height of the image, you need to add max-height after the max-width. Another way is to define the fixed dimension for both height and width, ensuring them staying square.
Would be more useful if you share the URL of the page with the code here 🙂
If you're not super sure about CSS code, I suggest you use a reliable tool that offers pre-built elements like this one - you can use them right away.
Feel free to give Foxify Smart pagebuilder a try. Foxify has various sections and elements, namely a multicolumn section that lets you build a nice image gallery in a minute.
Find my answer helpful? Give it a like :] Try Foxify now - #1 Conversion-focused page builder. Use FoxKit free - All-in-one Sales Boost. FoxEcom smart solutions impact sales, costs, and profit all at once.