Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Beginner. I have created a custom template for a CQWP in the ItemStyle.xsl. One thing that I am not sure about is how I could associate a css file so that anytime this template style is used the results are rendered the same way. Is there a good approach to this, or can I even do it?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Reference the CSS file in the masterpage being used on the site.

Open your masterpage in SharePoint Designer and add this line in the header tag:

<SharePoint:CssRegistration runat="server" name="path to css file" after="corev4.css" />
share|improve this answer
    
Agreed. Since the itemStyle.xsl is going to be global to your site, you would want to make the CSS global to your site as well. Include the CSS in your own 'global' custom CSS file, and link to it through your master page(s). –  JesseC Jul 5 '12 at 13:40
    
thanks. This certainly sounds like best practice to me, though I am not able to access master pages in our production system. So if I asked for a hack way to add to item style or another way to get around that, I am guessing the caveats would out weigh the benefit? Thanks for the help! –  Justin Jul 5 '12 at 13:52
    
Thanks, this really worked great as I was facing the problems in my post is: social.msdn.microsoft.com/Forums/en-US/… –  user10828 Sep 20 '12 at 5:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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