有没有办法为单个 page/node 添加 CSS?
Any way to add CSS for a single page/node?
特别是,我工作网站的主页是一个面板页面,它有很多不同的样式。现在 CSS 仅包含在主主题样式 sheet.
中
有没有办法说,"if this is node article, then add article.css"? CSS 喷油器是我要找的吗?
我可能有兴趣将其推广到其他 nodes/sections/etc,但目前我只想处理这一项。
我最后做了什么。
我正在使用 bartik 子主题,并在实际阅读 template.php 时发现有一些注释掉的代码用于包含条件样式 sheets。下面的代码完全符合我的需要:
if (drupal_is_front_page()) {
drupal_add_css(path_to_theme() . "/article.css", 'theme','all');
}
你可以看看 Code per Node module.refer the link here
特别是,我工作网站的主页是一个面板页面,它有很多不同的样式。现在 CSS 仅包含在主主题样式 sheet.
中有没有办法说,"if this is node article, then add article.css"? CSS 喷油器是我要找的吗?
我可能有兴趣将其推广到其他 nodes/sections/etc,但目前我只想处理这一项。
我最后做了什么。
我正在使用 bartik 子主题,并在实际阅读 template.php 时发现有一些注释掉的代码用于包含条件样式 sheets。下面的代码完全符合我的需要:
if (drupal_is_front_page()) {
drupal_add_css(path_to_theme() . "/article.css", 'theme','all');
}
你可以看看 Code per Node module.refer the link here