jeudi 4 août 2022

PHP add css class to element randomly using php

let's say I have a array with e.g. 3 css class names - I also have a loop of e.g. 50 items and I'd like to randomly assign one of the three classes to an element - however, most of the items should not get any class at all - is there a way to do this?

to make it more clear - I'd like to set up a tiled gallery in Wordpress using css grid - every few picture I'd like to either add a class: big, wide, or tall - a gallery can have any number of pictures. thank you in advance for your input.




Aucun commentaire:

Enregistrer un commentaire