The CSS solution in the link you posted should work. For adding CSS, there are a few things to consider
Create a folder custom inside theme/styles/web/css/ of your project directory. Create a file custom.css.
Add the mentioned CSS in your posted link in this file.
Make sure in your theme/settings.json file, your custom.css file is included under the “cssFiles” as shown below
"cssFiles": [
"styles/web/css/main.css",
"styles/web/css/custom/custom.css"
],
Now you can edit custom.css, save it. Run your app again then you will see the changes.
For further debugging, try inspect element feature of the browser to see if CSS styles are applied on the template grid HTML element.