Welcome to the LimeSurvey Community Forum

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

How can I change the background color for an individual question block?

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #156091 by tpartner
See here for info on inserting JavaScript - manual.limesurvey.org/Workarounds:_Manip...tc..29_in_LimeSurvey

Ben;s script will add a style rule to the <head> section but if you want to add a class to the question as in the above workaround, insert this script into the question text (don't modify anything except "header-red"):
Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#question{QID}').addClass('header-red');
  });
</script>

Then, if using the default template, you can insert something like this at the end of template.css:
Code:
.header-red td.questiontext {
  background-color: #FF0000;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
6 years 10 months ago #156128 by maxersloan
Thanks Tony. Works great with the default template. I'll have to play around with my real template to see how I can implement your solution.

Thanks again!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago - 6 years 10 months ago #156135 by tpartner
If you get stuck, post a link here to a live sample survey using that template and we'll tune the CSS selectors.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 10 months ago by tpartner.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose