我在 template.php 文件中创建了一个路径并包含在信息文件中。在我的源代码中我有我想要使用的路径。但是 css 文件没有显示在网络中并且在 perfomance.still 中清除了 drupal chache不包括 css。我必须做什么
模板.php
function phoenix_responsive_theme_preprocess_html(&$vars) {
drupal_add_css(
drupal_get_path('theme', 'phoenix_responsive_theme') . '/css/ie_style.css',
array(
'group' => CSS_THEME,
'browsers' => array(
'IE' => TRUE,
'!IE' => FALSE,
),
'weight' => 999,
'every_page' => TRUE,
)
);
}
function phoenix_responsive_theme_preprocess_maintenance_page(&$vars) {
// Add conditional stylesheets for IE.
drupal_add_css(drupal_get_path('theme', 'phoenix_responsive_theme') . '/css/ie_style.css',
array(
'group' => CSS_THEME,
'browsers' => array(
'IE' => TRUE,
'!IE' => FALSE,
),
'weight' => 999,
'every_page' => TRUE,
)
);
}
在html源码中看到的路径
<!--[if IE]>
<style type="text/css" media="all">
@import url("http://localhost/test/themes/phoenix_responsive_theme/css/ie_style.css?osct7n");
最佳答案
试试这个。
引用:Adding browser-specific style sheets
function yourthemename_preprocess_html(&$vars) {
drupal_add_css(
path_to_theme() . '/fix-ie.css',
array('weight' => CSS_THEME,
'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE),
'preprocess' => FALSE
));
}
关于html - 在 drupal 7 中为 IE 浏览器添加 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44843916/