在服务器上读取IE css

时间:2012-09-10 09:52:42

标签: css wordpress internet-explorer

我有一个基于wordpress的网站,当我在localhost上工作时,我正在使用此代码来阅读css:

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
<!--[if IE]>
    <link rel="stylesheet" href="<?php echo get_stylesheet_directory()."/ie.css"; ?>" media="screen" type="text/css" />
<![endif]-->

如您所见,代码的第二部分是在我在Internet Explorer上查看网站时更改css。它恰好在xampp上工作,但现在,在迁移到在线服务器之后,代码的第二部分无效,当我在IE上看到在线页面时,样式不适用。

任何暗示为什么会发生这种情况?

1 个答案:

答案 0 :(得分:3)

 <?php get_stylesheet_directory() ?>

返回绝对服务器路径;

http://codex.wordpress.org/Function_Reference/get_stylesheet_directory

将您的代码更改为;

 <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
 <!--[if IE]>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/ie.css"; ?>" media="screen" type="text/css" />
 <![endif]-->

它应该适合你。