maartendeckers Posted June 28, 2023 Share Posted June 28, 2023 Hi, Can anyone tell me what CSS-code I should add if I want to reduce the masonry grid gallery to 1 column on mobile, please? On desktop I still want it to display 2 columns. Thanks for your help, Maarten Link to comment
Solution tuanphan Posted June 28, 2023 Solution Share Posted June 28, 2023 (edited) Use this CSS code /* Masonry to grid mobile */ @media screen and (max-width:767px) { .gallery-masonry-wrapper.gallery-masonry-list--ready { height: auto !important; display: grid; grid-template-columns: repeat(1,1fr) !important; grid-column-gap: 10px; grid-row-gap: 10px; } figure.gallery-masonry-item { position: relative !important; width: 100% !important; transform: unset !important; } .gallery-masonry-item-wrapper { height: 100% !important; } figure.gallery-masonry-item img { width: 100% !important; } } Edited June 28, 2023 by tuanphan maartendeckers 1 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
maartendeckers Posted June 28, 2023 Author Share Posted June 28, 2023 @tuanphan Thanks very much! One slight problem however: not all of the images are displayed at 100% width. Is there a way to force them all to 100% of the screen width? Link to comment
tuanphan Posted June 28, 2023 Share Posted June 28, 2023 43 minutes ago, maartendeckers said: @tuanphan Thanks very much! One slight problem however: not all of the images are displayed at 100% width. Is there a way to force them all to 100% of the screen width? Can you share link to a page where you use Masonry? We can check again easier Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
maartendeckers Posted June 28, 2023 Author Share Posted June 28, 2023 @tuanphan https://maartendeckers.com/projecten/tentoonstelling-de-wereld-van-leo-timmers Link to comment
tuanphan Posted June 28, 2023 Share Posted June 28, 2023 Updated above code. You can add it again. Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
maartendeckers Posted June 28, 2023 Author Share Posted June 28, 2023 @tuanphan Works! Thanks very much! Link to comment
kelly_fletcher Posted September 5, 2023 Share Posted September 5, 2023 So glad I found this!! Worked a treat for me. Thank you very much @tuanphan & @maartendeckers ! 🙌🙏 tuanphan 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment