首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CSS / ZPT / Plone

CSS / ZPT / Plone
EN

Stack Overflow用户
提问于 2011-12-22 19:14:39
回答 1查看 269关注 0票数 2

我试着在ZPT页面中使用CSS来实现Plone。它唯一的工作方式就是内联css。在标题中使用style标签不起作用,也不会尝试使用链接的css文件。

有办法做到这一点吗?

EN

回答 1

Stack Overflow用户

发布于 2011-12-22 19:42:44

如果您只想在该模板中使用特定css,则首先必须注册css资源目录(在浏览器模块中),如下所示:

代码语言:javascript
复制
<!-- Register the resource directory for stylesheets -->
<browser:resourceDirectory
    name="[YOUR_PLONE_PRODUCT].styles"
    directory="styles"
    layer=".interfaces.IThemeSpecific"
    />

然后像这样在你的模板中使用它:

代码语言:javascript
复制
<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">
     ...

下面是一些有用的文档:

  • http://collective-docs.readthedocs.org/en/latest/templates_css_and_javascripts/css.html
  • http://collective-docs.readthedocs.org/en/latest/templates_css_and_javascripts/template_basics.html
  • http://plone.org/documentation/manual/theme-reference/buildingblocks/skin/style-sheets/css
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8603057

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档