简体   繁体   中英

Sharepoint 2013 css reference in master page

In SharePoint 2013, I'm trying to include a reference to an additional CSS file but am not getting this to work. Here is the process I've followed:

  1. Duplicated seattle master page and renamed it, uploaded it.
  2. Made sure the new master page is the Site Master Page through the interface
  3. Loaded my CSS file to the style library
  4. Added a reference to that style library into the master page and checked it in

I know the CSS works when I paste it into a Script Editor on a page, but of course I don't want to do that on every page. But the reference to it clearly doesn't work. Here are versions I've tried based on various websites. The first line is always on:

<SharePoint:CssRegistration ID="CssRegistration1" Name="Themable/corev15.css" runat="server" />

These other lines were tried one at a time, based on various articles on the web. None work.

<SharePoint:CssRegistration ID="CssRegistration2" Name="&#60;% $SPUrl:~SiteCollection/Style Library/CustomCSS_OAMC.css %&#62;" After="corev15.css" runat="server" />

<SharePoint:CssRegistration ID="CssRegistration3" name="&lt;% $SPUrl:~sitecollection/Style Library/CustomCSS_OAMC.css %&gt;" runat="server"  />

<SharePoint:CssRegistration ID="CssRegistration4" Name="<% $SPUrl:~SiteCollection/Style Library/CustomCSS_OAMC.css%>" runat="server" />

My style sheet code is below for reference"

<style type="text/css">
#sideNavBox { display: none; }
#contentBox { margin-left: 20px; }
#topNav {  margin-top: 50px; }
#siteIcon { height: 100px; }

.ms-siteicon-img {
max-height: 200px;
max-width: 500px; }

#s4-bodyContainer #titleAreaBox.ms-table, #s4-bodyContainer #titleAreaBox > 
#titleAreaRow {display:block;}
#s4-bodyContainer #titleAreaBox > #titleAreaRow > #siteIcon 
{float:left;display:block;margin:0 auto;}
</style>

Recently even I tried to create copy of Seattle master page, Also i needed to apply some custom css to the master page. You can find head section and under SharePoint's default css references place css reference with link tag that's it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM