I tried using CSS in ZPT page for Plone. The only way it worked was as inline css. Using the style tag in the header didn't work, neither trying to use a linked css file.
Is there a way to do it?
I tried using CSS in ZPT page for Plone. The only way it worked was as inline css. Using the style tag in the header didn't work, neither trying to use a linked css file.
Is there a way to do it?
If you want to use that specific css only in that template then first you will have to register your css resources directory (in the browser module) like this:
<!-- Register the resource directory for stylesheets -->
<browser:resourceDirectory
name="[YOUR_PLONE_PRODUCT].styles"
directory="styles"
layer=".interfaces.IThemeSpecific"
/>
And then use it like this in your template:
<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">
...
Here's some useful doc: