html - 在 drupal 7 中为 IE 浏览器添加 css

标签 html css drupal

我在 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/

相关文章:

javascript - jQuery ReplaceWith() 不替换新值

javascript - 在 Angular 模型中显示数据的问题

html - iText Flying Saucer 页脚只显示在最后一页

git - 使用 git : committed changes in one branch affect 'master'

css - drupal..如何修改内容中显示的登录或注册样式

javascript - 在标记传单 map 的弹出窗口中插入多个倒计时

html - rails : Why are white-spaces defined in templates shown?

html - 如何将此 bootstrap 4 表单垂直移动到屏幕中心?

css - 容器 DIV 未垂直环绕

php - 确定我是否应该创建新的 Drupal 模块的最佳实践是什么?