Alternate Shading for Identical Questions? | XM Community
Skip to main content
Question

Alternate Shading for Identical Questions?

  • August 20, 2021
  • 2 replies
  • 43 views

I have 50 questions (per page) that are practically identical, and I want to switch background colors every other question to help people visually distinguish where they are.
Changing the container color changes all question colors, and only using a question seperator is sub-optimal. I can't change colors based question ID number either because the questions are randomised, so there isn't a consistent order for alternate shading.
Can anyone help me or point me in the right direction?

2 replies

JeremyK
Level 3 ●●●
Forum|alt.badge.img+7
  • Level 3 ●●●
  • August 25, 2021

Hey rdkn, take a look at jQuery's nth-child selector. If you're code-savvy, this will give you what you're looking for. Basically, it's those tables you see online where every other line is a shade of grey. You'll just need to play with what class you'll need to select; shouldn't be too difficult. Let me know if you get stuck!


JeremyK
Level 3 ●●●
Forum|alt.badge.img+7
  • Level 3 ●●●
  • August 25, 2021

W3Schools had a really good, easy to read demo of this; posting it here for your convenience.