Tuesday 23 June 2015

Corev15.css File in SharePoint

In SharePoint 2013, SharePoint uses the seattle.master page by default for Team sites, Publishing sites, and Team sites with Publishing enabled. It uses mysite15.master for OneDrive for Business sites. Each .master file refers to the corev15.css file, which is built from a variety of .css files delivered with SharePoint out of the box.
All default master pages use corev15.css when processing styles, and rely on the CSS cascade and CSS file sharing to resolve which styles are applied to specific controls and elements in regions of a page. Multiple CSS files are also combined to build the oslo.css file, which is used with the oslo.master master page.

A lot of CSS is applied to SharePoint by default. The corev15.css file is the main source for styles in SharePoint. This file is stored in the SharePoint 15 folder on the server at \TEMPLATE\LAYOUTS\1033\STYLES\Themable\COREV15.CSS and not in the Master Page Gallery of the root site and home page.
To see how SharePoint uses CSS out of the box, look at the corev15.css file by using the developer tools in your web browser. In Internet Explorer, use the Internet Explorer Developer Toolbar (access it by pressing F12) and choose the CSS tab to view corev15.css.
Styles defined in corev15.css use the .ms- , and .s4- prefixes, which indicate styles that were created by Microsoft. Corev15.css also uses a lot of child and descendent selectors.
When you view the file, you’ll notice many comments in this format: /* [ReplaceFont ( themeFont:”body”)] */. SharePoint reads these comments when a composed look is applied. The comments tell SharePoint to change the attribute of the CSS that immediately follows the comment. Applying a composed look might change many of the default colors, fonts, and background images that are applied, and subsequently update the settings in corev15.css.
Note
Selecting the corev15.css file this way loads the rendered CSS rather than the saved CSS. Sometimes you might find discrepancies between the two. User agents such as browsers can also change rendering in response to user actions.
Important
Do not log on to the server and edit or customize core SharePoint CSS files in the SharePoint root. Doing so will negatively impact support and upgrade. Never edit the corev15.css directly; always create a copy, rename it, and edit the new file instead. Editing corev15.css will apply branding to all web applications on the server.

To create a custom style sheet for SharePoint

  1. Make a copy of corev15.css and name it contosov15.css.
  2. Open contosov15.css and modify the CssRegistration line to point to contosov15.css from corev15.css, as shown in the following example.
    <SharePoint:CssRegistration Name=”Themable/contoso.css” runat=”server” />
    
  3. Below the CssRegistration line, add the following.
    <SharePoint:CssRegistration name=”/_catalogs/masterpage/contoso/contoso.css” 
    runat=”server”>

In case of Office 365

1. Open corev15.css from the following url :
https://ursite/_layouts/15/1033/styles/Themable/corev15.css

2. Download the file

3. open notepad copy the contents same to same make changes and save the file .

4. Upload the file in masterpage gallery and publish a major version of it.

5. Add the
<link rel="stylesheet" id="style-css" href="css/ur css file name.css" type="text/css" media="all" />


tag
below
<meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0" />
tag

in the masterpage
 <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0" />
                 <link rel="stylesheet" id="style-css" href="css/ur css file name.css" type="text/css" media="all" />
        <!--DC:Project-->
        <!--[if gte mso 9]><xml>