在 Sharepoint Web 部件中使用自定义 css 作为嵌入式资源不起作用,为什么?
我在这里读到了另一个问题,如何在我的 Sharepoint WebPart 中使用自定义 CSS。所以我点击了这个链接:
http://www .synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=42
我把我的CSS作为嵌入式资源。一切正常,我启动页面。
但我的风格却没有出现。
我查看源代码,找到了我的资源:
<script src="/WebResource.axd?d=YuTREer2woiGbjiSaZdP0bLrdm6vpTygUffdwMFJr0zmn76B3vav0QRpmxzvYvKzZRnmgKpNbLHpnJf-W4rfrv-MrIZEoz6tWi5xHXTiN3lcxdP3s7ysDExW-eBQTlH8cUrMRw2&t=634369276247430484" type="text/javascript"></script>
这引导我找到我的 css:
.webPartContainer
{
background-color:Aqua;
}
.webPartContainer .Text
{
font-size:xx-large;
}
这里是它引用样式的地方:
<td class="ms-WPBorder" valign="top">
<div WebPartID="2109154d-6921-46ac-84d4-8ce24a926617" HasPers="false" id="WebPartctl00_m_g_2109154d_6921_46ac_84d4_8ce24a926617" width="100%" class="ms-WPBody" allowDelete="false" allowExport="false" style="" >
<div id="ctl00_m_g_2109154d_6921_46ac_84d4_8ce24a926617">
<div class="webPartContainer">
<span class="Text">Hello World with container!</span>
</div>
</div>
</div>
</td>
可能发生了什么?
提前致谢 !
编辑:CssRegistration 给我权限错误,为什么?
I've read in another question here how could I use custom CSS within my Sharepoint WebPart. So I followed this link:
http://www.synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=42
And I put my css as an embedded resource. Everything ok, I launch the page.
But my style doesn't appear.
I peek at the source code, and I find my resource:
<script src="/WebResource.axd?d=YuTREer2woiGbjiSaZdP0bLrdm6vpTygUffdwMFJr0zmn76B3vav0QRpmxzvYvKzZRnmgKpNbLHpnJf-W4rfrv-MrIZEoz6tWi5xHXTiN3lcxdP3s7ysDExW-eBQTlH8cUrMRw2&t=634369276247430484" type="text/javascript"></script>
Which leads me to my css:
.webPartContainer
{
background-color:Aqua;
}
.webPartContainer .Text
{
font-size:xx-large;
}
And here's where it references the styles:
<td class="ms-WPBorder" valign="top">
<div WebPartID="2109154d-6921-46ac-84d4-8ce24a926617" HasPers="false" id="WebPartctl00_m_g_2109154d_6921_46ac_84d4_8ce24a926617" width="100%" class="ms-WPBody" allowDelete="false" allowExport="false" style="" >
<div id="ctl00_m_g_2109154d_6921_46ac_84d4_8ce24a926617">
<div class="webPartContainer">
<span class="Text">Hello World with container!</span>
</div>
</div>
</div>
</td>
What's possibly happening ?
Thanks in advance !
EDIT: CssRegistration gives me permission errors, why ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
浏览器不期望
The browser don't expect the content of a <script type='text/javascript'> tag to be CSS.
So you should change your code to something like this: