CSS for each subquestion

More
2 months 2 days ago - 2 months 2 days ago #196290 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: 2 months 2 days ago by FSoave.

Please Log in to join the conversation.

LimeSurvey Partners
More
2 months 2 days ago #196296 by tpartner
Replied by tpartner on topic CSS for each subquestion
You can use the CSS nth-child() selector something like this:

<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.
Official LimeSurvey Partner - partnersurveys.com
Attachments:

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now