开发者

How to deploy custom style changes to a bunch of master pages in SharePoint

I'm working in SharePoint 2010 and I was wondering is there a way to deploy a single css change to masterpage for every child site in my site collection? I'm using a team site and I'm using the v4.开发者_JS百科master.


I'm assuming that all your subsites are referencing a single masterpage at the root of your site collection.

I'm also assuming that since you're using an OOTB masterpage (v4.master), that it remains "untouched" and so doesn't have any custom CSS in it.

If this is correct so far, you've got three options:

  1. RELATIVE CSS. You can create a custom CSS file and add a reference to it in the head of your masterpage. This change only has to made once and will be reflected on all pages in all sites, however it does mean that you'll need to edit the HTML in the masterpage, so I wouldn't recommend this if you are using one of the OOTB files such as v4.master.

<SharePoint:CssRegistration runat="server" Name="custom.css" After="corev4.css" EnableCssTheming="false">

  1. THEME. Create a new site theme which contains your custom CSS file, then simply assign it to your site via the Site Settings UI. This doesn't require any changes to the masterpage, however themes are not automatically applied to new subsites when they're created. The only way to automate this would be through a feature or feature receiver.

  2. ALTERNATE CSS. Create your own custom CSS file, upload it to your site's Style Library folder and then appoint it as the Alternate CSS. This setting simply allows a designer to specify a URL to a CSS file which will be loaded AFTER the default SP styles. The Alternate CSS setting is inherited automatically by all child sites (by default), however if you don't have the publishing features enabled then you can't set it via the Site Settings UI, you'll have to do it through code or a Powershell script.

I hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜