none
Branding my Sharepoint site & Style Sheets

    שאלה

  • Hi everyone

    I'm in charge of branding our 2010 enterprise Sharepoint.  I've tried to do my research, but I'd really appreciate if you could confirm my 'plan'.

    I want the top level site and all sites beneath it to have the same branding.  I don't require any structural changes to the master page (not yet, anyway); Most everything I need to do is cosmetic.  Here's what I think I know:

    1)  Create a style sheet (mystyles.css)
    2)  Reference the style sheet in the master page via the CssRegistration tag using the after parameter so that my styles are applied last.

    and here are the questions I have:

    1)  If I reference the style sheet using the CssRegistration tag, do I still need to attach it (CssLink)?  I've tried this as a test but corev4 still seems to be 'winning'.
    2)  Is the style sheet attached to the master page or to the content page.  I would think that in order to style your whole implementation, you would need to attach your style sheet to a master page.  So, can you still style elements contained on the content pages like list titles or the main text on the body throughout the site?
    3)  Will all existing sites inherit the new style once applied at the top site?
    4)  Is it true that to apply a custom style sheet, you must modify the master page?  I'm treading a little lightly here, as I'm new at this. 

    Thanks in advance for your help,

    Lee

    יום שלישי 01 פברואר 2011 04:58

כל התגובות

  • 1)  If I reference the style sheet using the CssRegistration tag, do I still need to attach it (CssLink)?  I've tried this as a test but corev4 still seems to be 'winning'.

    CSS is called Cascading Style Sheet for a reason. 

    2)  Is the style sheet attached to the master page or to the content page.  I would think that in order to style your whole implementation, you would need to attach your style sheet to a master page.  So, can you still style elements contained on the content pages like list titles or the main text on the body throughout the site?

    If the CSSRegistration tag is on your master page, the stylesheet is attached to your master page. 
    If you'd like to only style a specific page, the quick way of adding page level CSS / styling is to use the Content Editor Web Part.
    I'd say that what you are looking for really is a proper development path on branding sites.  Most probably you'd like to customize common elements on your site to look the same versus one-off designs.

    3)  Will all existing sites inherit the new style once applied at the top site?

    If all child sites underneath the parent site are set to inherit branding from the parent, then yes, once you apply the style it'll apply to all sites.

     4)  Is it true that to apply a custom style sheet, you must modify the master page?  I'm treading a little lightly here, as I'm new at this. 

    Not true at all.  you can apply custom style sheet on the same settings page as the master page, and only specify the css file.


    Connect with me!

    Email | Facebook | LinkedIn | @kkhipple | @sharepointbuzz
    Sites Kanwal Khipple | SharePoint Buzz | BrightStarr

    יום שלישי 12 יוני 2012 12:22
  • Hi Lee,

    Assuming that you have only one custom style sheet (mystyles.css) and you do not want to modify the master page if you do not have to, make sure that you place your style sheet in the Style Library found in your root master page. The quickest way to now link to this style sheet is to set it as your Alternate CSS found in Site Settings->Look and Feel->Master Pages or in a browser at /_layouts/ChangeSiteMasterPage.aspx. You can now link your site to your style sheet without modifying your Master Page, and this will make sure that your stylesheet is loaded after the corev4.css.

    If you do not want to use the Alterate CSS propertly, that is ok, then you will want to use the CSSRegistartion tag, but be sure to include the After property as well, i.e.

    <SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/MyBranding/mystyles.css %>" After="corev4.css" runat="server"/>

    You do not need to also include a html <link> tag.

    This method will always apply your style sheet to your entire site. Subsites can be configured to inherit both the Alternate CSS value as well as the Master Page. Normally CSS modifications are made to a particular site, not to a particular page. Although it is common to add CSS in a Content editor, I would not recommend that as it can be more difficult to debug and more importantly inline styles are generally bad practice for optimization reasons as well as for general best practices.

    As for your last two questions, they have already been successfully answered.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    יום שישי 22 יוני 2012 19:26