Hello. I am using a custom CSS code that allows me to right-justify question containers. However, I only want this custom CSS code to apply to certain questions (or blocks), and not the entire survey. How can I make it so that a custom CSS code only applies to certain questions?
Here is the code I am using, which then applies to the whole survey:
.Skin .SkinInner {
margin: 0 0 0 auto !important;
}
I tried to use this code to apply this only to one question, but it doesn't seem to work:
.Skin #QID123, .SkinInner #QID123 {
margin: 0 0 0 auto !important;
}
I also need the code to apply to multiple questions, not just one, so if someone could help with a code that allows me to apply this to multiple selected questions, it is most appreciated!
How to apply custom CSS code to selected questions
Best answer by Tom_1842
Hi there, if you still need, CSS can be applied to specific questions from the Look & Feel's Custom CSS by using the QID, like in the below:
#QID1 .QuestionBody {
background: red;
}
You could also add the styling with jQuery, though this can sometimes result in a "flash" since the styling isnt applied until the page is loaded. You could add something like the below to the question's JavaScript.
jQuery("#"+this.questionId+" .QuestionBody").css("background","red");
Another method is to apply CSS to just a single page. This can be done by adding CSS in a
Click to write the question text
This is the method that I would suggest for your use case since I believe SkinInner is more about the whole page than any specific question. So for each page that you want the questions to be right justified, try including the below in the Question Text on any question on that page:
Click to write the question text
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
