SharePoint 2010 corev4.css 更改未反映在子网站上

发布于 2024-10-11 07:25:19 字数 575 浏览 6 评论 0原文

当我们对 SharePoint 2010 网站根目录下的 _themes 文件夹中的 corev4.css 进行更改时,它会显示在根 URL 上,但不会显示在任何子网站上,即使我们选中了复选框“重置所有子网站以继承系统主网站”页面设置”。

http://SiteName/_Layouts/ChangeSiteMasterPage.aspx

物理更改在那里,因此我们知道 MasterPage 正在继承,但设计/CSS 更改不在子站点上......

为什么呢?

编辑

好的,我通过在 MasterPage 的 head 标记中添加以下代码行,设法使所有子网站看起来都相同,并且成功了。

<SharePoint:CssRegistration Name="/_styles/S1.css" runat="server" EnableCssTheming="true" After="true"/>

但现在,当我更改任何网站中的主题时,它确实会将其更改为正确的主题,但它会忽略我的 S1.css 中的更改

When we make changes to our corev4.css in the _themes folder in the root of our SharePoint 2010 site it shows up on the root URL but not on any subsites even though we did select the check box "Reset all subsites to inherit the system master page setting".

http://SiteName/_Layouts/ChangeSiteMasterPage.aspx

The physical changes are there so we know that the MasterPage is inheriting, but the design/css changes are not on the subsites.....

Why is that?

Edit

Ok, I managed to make all the subsites look the same by adding the following line of code in the head tag in my MasterPage and it worked.

<SharePoint:CssRegistration Name="/_styles/S1.css" runat="server" EnableCssTheming="true" After="true"/>

But now when I change the theme in any of my sites it does change it to the correct theme but it ignores my cnanges from my S1.css

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

蔚蓝源自深海 2024-10-18 07:25:19

会更干净(也是最佳实践)

如果您在自己的自定义 Css 文件中添加对 corev4.css 样式的覆盖,并使用站点设置(与您可以更改母版页的页面相同的页面)将其引用为备用 css 文件,那么这 比 corev4.css 晚加载,因此它将使用您的样式而不是开箱即用的样式。

编辑:

将custom.css添加到您的网站(即样式库中)。然后将该站点指向该文件(该设置称为备用 css,可以在外观和感觉 -> 母版页下找到)。

在您的自定义 CSS 中,定义与 corev4.css 中的样式同名的样式。此覆盖样式是因为 sharepoint 将在引用 corev4.css 之后引用您的 CSS 文件。

假设您想要覆盖搜索区域的某些样式,您可以在 css 中定义一个名为 .s4-search 的样式。通过在这里定义规则,corev4.css中同一个类中的相同规则将被覆盖

It would be cleaner (and best practice) if you would add overrides to the corev4.css styles in your own Custom Css file and reference that as an alternate css file using site settings (same page as where you can change the masterpage)

It would get loaded later than the corev4.css and because of that it would use your styles instead of the out of the box ones.

Edit:

Add a custom.css to your site (i.e. in the style library). Then point the site to that file (the setting is called alternate css and can be found under look & feel -> masterpage).

In your custom Css, define styles with the same name as those in corev4.css. This override styles becasue sharepoint will reference your CSS file AFTER it references corev4.css.

So say you want to override some styling of the search area, you would define a style named .s4-search in your css. by defining rules here, the same rules in the same class in corev4.css will be overriden

醉酒的小男人 2024-10-18 07:25:19

母版页与它们的继承有很大关系,因为所有内容均由位于母版页中的 SharePoint:CssLink 组件管理。

在 SharePoint 2010 中管理 CSS 和主题非常困难。

我在这个话题上花了几个小时。

你可以检查这个...

http://mosshowto.blogspot。 com/2010/06/sharepoint-2010-registering-css.html

还有一个我认为艾蒂安的答案:

http://mosshowto.blogspot.com/2009/12/sharepoint-2010-wiki-styles.html

现在Bittersweet 主题应用于网站,如果您尝试修改 corev4.css 文件,您将不会看到任何修改,因为 CSS 现在自动存储在文件中由 SharePoint 2010 生成并位于具有此类 url 的网站文件夹中:

/_themes/20/corev4-8A0ABD2F.css?ctag=21

仅当您应用 SharePoint 网站主题的默认选项时,SharePoint 网站才会重用 corev4.css 文件,这意味着,没有主题。这意味着通过对 themable/corev4.css 文件应用修改来修改样式并不是一个好主意,因为这些修改对于应用 SharePoint 2010 主题的任何网站都不可见。
除了一种情况之外,如果我们想要删除 SharePoint 2010 开箱即用版本提供的样式,那么这是值得的。稍后我们将在现实世界中的示例中说明该情况。
这导致寻找一种修改自定义文件中样式的方法

希望有帮助......

马克

The master page has a lot to do with them inheriting beacause all is managed by the SharePoint:CssLink component located in the master.

Managing CSS and themes within SharePoint 2010 is very difficult.

I spent hours on the topic.

you can check this...

http://mosshowto.blogspot.com/2010/06/sharepoint-2010-registering-css.html

and there is also this one where there is I think the answer to Etienne:

http://mosshowto.blogspot.com/2009/12/sharepoint-2010-wiki-styles.html

Now that the Bittersweet theme is applied to the site, if you try to modify the corev4.css file, you won't see any modification because the CSS are now stored in a file automatically generated by SharePoint 2010 and located in a site folder with this kind of url:

/_themes/20/corev4-8A0ABD2F.css?ctag=21

The SharePoint site will reuse the corev4.css file only if you apply the default option for the SharePoint site themes, that is to mean, no theme. That means that it is not a good idea to modify the styles by applying modifications to the themable/corev4.css file since these modifications won't be visible for any sites for which a SharePoint 2010 theme is applied.
This is worth except for one case, if we want to remove the styles provided by the Out Of The Box version of SharePoint 2010. We will illustrate that case in a real world example later.
This leads in looks for a means to modify the styles in a custom file

Hope that helps...

Marc

凉栀 2024-10-18 07:25:19

子网站将有自己的 _themes 文件夹。这可能就是您没有看到子网站发生变化的原因。

2007年,core.css曾经在样式库中,因此从未出现过这个问题。

你能检查一下你的样式库是否有一个被你的母版页引用的CSS吗?理想情况下,您应该修改的是 CSS,而不是 _themes 下的 CSS。

The subsite would have its own _themes folder. That's the reason probably you are not seeing the change in subsites.

In 2007, core.css used to be in Style Library and thus this problem never occurred.

Can you check if your style library has a CSS which is referenced by your master page ? This is the CSS which you should be ideally modifying instead of one under _themes.

一抹苦笑 2024-10-18 07:25:19

MasterPage 与主题继承关系不大。

为了继承主题,您需要激活各种发布功能(至少是站点范围,也可能是 Web 范围),然后您将在站点设置 => 中获得该选项。主题页面可重置子网站以继承主题。

正如 Colin 所说,修改 corev4.css 文件并不是一个理想的选择,因为 Microsoft 服务包会更新该文件并覆盖您的更改。

The MasterPage has very little to do with Themes inheriting.

In order to inherit themes, you will need to activate the various Publishing features (at least Site scoped, probably the Web scoped as well), then you will get the option in the Site Settings => Themes page to reset subsites to inherit the theme as well.

As Colin says, modifying the corev4.css file isn't an ideal option incase a Microsoft service pack updates it and overwrites your changes.

我不会写诗 2024-10-18 07:25:19

根据我的理解,它没有存储在样式库中,因此在这种情况下,它将存储在 14hive 中:

不要覆盖 sharepoint corev4.css,而是以另一种样式覆盖它,如果您想使用相同的 id 或类覆盖也可以!只需在每个项目后使用 !important 例如:

.S4-td
{
   width:100% !important;
}

Important 会覆盖任何其他 css!拥有 After="corev4.css" 也会这样做;)但是如果你想明确地说你只想要那种风格,那么我会把方法放在上面!

要在自定义 css 中使用上面的内容,请在母版页中使用它:

<!-- link to our custom css  -->
<SharePoint:CssRegistration ID="CssRegistration1" name="/_layouts/customcss/css/style.css" After="corev4.css" runat="server"/>

或者

<!-- link to our custom css  -->
<SharePoint:CssRegistration ID="CssRegistration1" name="/Style%20Library/style.css" After="corev4.css" runat="server"/>

如果您想执行上面的操作但想知道 v4 中的类和 id 是什么而不是位于此处,则仅供参考:

C:\Program Files\Common Files\Microsoft Shared\Web Server
扩展\14\TEMPLATE\LAYOUTS\1033\STYLES\corev4.css

在您的情况下同样适用于上面!

<SharePoint:CssRegistration ID="CssRegistration1" Name="/_styles/S1.css" After="corev4.css" runat="server"/>

这应该可以解决问题;)

https://sharepoint .stackexchange.com/questions/71591/where-is-corev4-css- located-in-sharepoint-designer-2013

from my understanding its not stored in the styles library, so in that case it would be stored in 14hive:

dont overwrite sharepoint corev4.css, instead ovwerite it in another style, if you want to overwite with the same id or class that is fine! just use !important after each item eg:

.S4-td
{
   width:100% !important;
}

Important overwites any other css! having After="corev4.css" will do it aswell ;) but if you want to explicitly say you only want that style then i would put the method above!

to use above in custom css use this in masterpage:

<!-- link to our custom css  -->
<SharePoint:CssRegistration ID="CssRegistration1" name="/_layouts/customcss/css/style.css" After="corev4.css" runat="server"/>

or

<!-- link to our custom css  -->
<SharePoint:CssRegistration ID="CssRegistration1" name="/Style%20Library/style.css" After="corev4.css" runat="server"/>

just for reference if you want to do above but want to know what classes and id's are in v4 than its located here:

C:\Program Files\Common Files\Microsoft Shared\Web Server
Extensions\14\TEMPLATE\LAYOUTS\1033\STYLES\corev4.css

in your case the same applies above!

<SharePoint:CssRegistration ID="CssRegistration1" Name="/_styles/S1.css" After="corev4.css" runat="server"/>

that should do the trick ;)

https://sharepoint.stackexchange.com/questions/71591/where-is-corev4-css-located-in-sharepoint-designer-2013

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文