Hello everyone! I’m trying to use CMS to create a sort of styled grid whereas every other row is arranged the same, as seen in this picture. I’m trying to find a way to accomplish this styling using CMS. I’m aware that I could style each one individually, limiting each CMS list to 1 item, however using this method I’d only be able to have 20 on each page. Does anyone know how I could pull off this effect? Potentially using an “nth” in custom code? I don’t code but I have a basic understanding of how to integrate it.
Also you’d get a hit in performance in the designer.
You can use pseudo classes to achieve what you want. Let me a couple of minutes to adapt an example for you and I’m back. You should post our read-only link.
I’m using flexbox for the layout of the items of the list. With pseudo class :nth-child(even) i then target every other one, then its image child. Then I add the CSS rule of order:1 to the image, so that it inverts the flexbox order. So all even lines have the image on the right. No need to also do something on the even lines, they stay as they are.
Thanks for your reply! So I understand the logic - you need to call on every other (even) CMS item, then set the image order for that image in the parent flexbox to “1”. That should make it so that every other image is aligned properly? However I don’t know how to integrate into my site. I’ll make the site readable for you.
Eureka! Nevermind on my last response. I kept digging, and figured it out! I didn’t know how to target a child element in css originally, but once I found out how, the solution was quite simple! Thanks for challenging me
For those wondering, here is the code that I used. I see a ton of potential for “nth-child” in the future!