Web part

Is there any way to change the background color on the query web part shown above?

  • Check the sites style library and see if there is a copy of the file itemstyle.xsl and check for the modifications there. If there is only the original file, check inside there. You could use F12 to see where the style is comming from. Commented Nov 9, 2015 at 15:04
  • Checked the itemstyle.xsl but there were no sections for color, also checked the contentQueryMain.xsl and did not see any sections for color either. I can see it in the source code if I F12 on the page it is on. Any other ideas as to where this might be stored? Commented Nov 9, 2015 at 17:00

1 Answer 1


Alternative to editing your xsl style sheets you can try this: Add the code below to a script editor web part or save this in a text file and use a content editor web part to load that file on your CQWP page.

    li.dfwp-item div {
      background-color: cornflowerblue;
      margin-bottom: 2%;
      text-align: center;


    li.dfwp-item div a {
      color: #fff;

  • Hello, you helped me fix my previous issue, but I have a follow-up regarding this. I added another section that does the same thing but for different content. The issue is that this also sets that section to have the red background, is there a way to fix that, or alternatively can I just change the link color in the new one to white instead of blue? Commented Dec 21, 2015 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.