我试着在ZPT页面中使用CSS来实现Plone。它唯一的工作方式就是内联css。在标题中使用style标签不起作用,也不会尝试使用链接的css文件。
有办法做到这一点吗?
发布于 2011-12-22 19:42:44
如果您只想在该模板中使用特定css,则首先必须注册css资源目录(在浏览器模块中),如下所示:
<!-- Register the resource directory for stylesheets -->
<browser:resourceDirectory
name="[YOUR_PLONE_PRODUCT].styles"
directory="styles"
layer=".interfaces.IThemeSpecific"
/>然后像这样在你的模板中使用它:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en"
metal:use-macro="here/main_template/macros/master"
i18n:domain="[YOUR_PLONE_PRODUCT]">
<metal:slot fill-slot="css_slot">
<link href="myspecialstyle.css"
rel="stylesheet"
type="text/css"
tal:attributes="href string:${context/portal_url}/++resource++[YOUR_PLONE_PRODUCT].styles/myspecialstyle.css"/>
</metal:slot>
<body>
<metal:main fill-slot="main">
...下面是一些有用的文档:
https://stackoverflow.com/questions/8603057
复制相似问题