vendredi 27 octobre 2017

If/Else statement in Sass to alter css based on number of items in list

I have a list of items that I am stying with flex. They're stacked in one horizontal row.

I wondered whether it would be possible to write an if/else statement that basically does the following:

If there are 4 or less items in the list, use justify-content: space-between, but if there are 5 or more items, use justify-content: space-evenly.

I'm struggling to get my head around how I would write such a thing to test it and couldn't quite find anything in the Sass docs that covers such a scenario - is something like this possible?

Aucun commentaire:

Enregistrer un commentaire