Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

CSS for each subquestion

  • FSoave
  • FSoave's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 11 months ago - 3 years 11 months ago #196290 by FSoave
CSS for each subquestion was created by FSoave
Hi,
I have a multiple short text field. I see I can add a CSS class to the question.
But what I'd like to do is to modify the CSS for each of the text fields (subquestions) I have.

1) Where is the correct place to do this?
2) What's the best way to target each element in the CSS code?

Thanks
Last edit: 3 years 11 months ago by FSoave.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #196296 by tpartner
Replied by tpartner on topic CSS for each subquestion
You can use the CSS nth-child() selector something like this:

Code:
<style type="text/css">
 
  #question{QID} .answer-item:nth-child(1) input.form-control {
    border: 2px solid green;
 
  }
 
  #question{QID} .answer-item:nth-child(2) input.form-control {
    border: 2px solid pink;
 
  }
 
  #question{QID} .answer-item:nth-child(3) input.form-control {
    border: 2px solid blue;
 
  }
 
  #question{QID} .answer-item:nth-child(4) input.form-control {
    border: 2px solid red;
 
  }
</style>


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose