简体   繁体   English

主页中的Sharepoint 2013 CSS参考

[英]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. 在SharePoint 2013中,我尝试包含对其他CSS文件的引用,但没有使它起作用。 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 将我的CSS文件加载到样式库
  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. 我知道将CSS粘贴到页面上的“脚本编辑器”中时CSS可以工作的原因,但是我当然不想在每个页面上都这样做。 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. 最近,即使我试图创建西雅图主页的副本,也需要将一些自定义CSS应用于主页。 You can find head section and under SharePoint's default css references place css reference with link tag that's it. 您可以找到标题部分,并在SharePoint的默认CSS参考下放置带有链接标记的CSS参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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