Tuesday, April 26, 2011

Adding a stylesheet to a SharePoint masterpage using the CSSRegistration control

Sharepoint has a .NET control for registering CSS files in a SharePoint masterpage called SharePoint:CSSRegistration. Use the ~Site token to specify the current site. This control goes in the head section of the masterpage.

<SharePoint:CssRegistration name="<% $SPUrl:~Site/CSS/gilariver.css%>" runat="server"/>

New to SharePoint 2010
You can specify the order using the After property. The After property contains the name of the CSS that you want to place the CSS after. The ConditionalExpression parameter will tell the CssLink to render the Conditional-CSS code as well as the CSS link.

No comments:

Post a Comment