2012-04-23 72 views
0

enter code here我知道這已經提出了很多次,但我真的很努力地找到答案。有條件的CSS的IE瀏覽器在WordPress的不工作

我目前使用下面的代碼:

<!--[if IE 9]> 
    <style type="text/css">@import "<?php bloginfo('stylesheet_directory'); ?>/ie.css";</style> 
<![endif]--> 
<!--[if IE 8]> 
    <style type="text/css">@import "<?php bloginfo('stylesheet_directory'); ?>/ie8.css";</style> 
<![endif]--> 

然而,第一個樣式表完全不拿起和IE8一個僅在IE9回升。 我真的不知道我在做什麼錯在這裏。

使用嚴格的XHTML。任何幫助將大規模讚賞。

哦,是的,我的主要重置和其他樣式表是在這些之上。此外,我正在使用Wordpress - 這不應該有所作爲。

編輯:

下面是一些更詳細

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
     <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title> 
     <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/reset.css" type="text/css" /> 
     <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" /> 
     <!--[if IE 9]> 
     <link href="<?php bloginfo('stylesheet_directory'); ?>/ie.css" type="text/css" rel="stylesheet" /> 
     <![endif]--> 
     <!--[if IE 8]> 
     <link href="<?php bloginfo('stylesheet_directory'); ?>/ie8.css" type="text/css" rel="stylesheet" /> 
     <![endif]--> 
     <link href='http://fonts.googleapis.com/css?family=Averia+Serif+Libre:400,700' rel='stylesheet' type='text/css' /> 
     <link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css' /> 

然後我寫一些JavaScript的頭部和jQuery的調用。沒有什麼特別的。

+0

請提供一些更多的背景下,似乎罰款(語法明智)。 – 2012-04-23 19:02:37

+0

您還應該避免使用@ @ import'聲明樣式,因爲在所有其他頁面內容加載後,IE會讀取它。嘗試將文件路徑注入到「鏈接」的「href」屬性中。 – 2012-04-23 19:08:48

+0

你有沒有檢查你的IE是否工作在怪癖模式? – TsukinoMai 2012-04-23 19:28:42

回答

1

假定它們位於文檔head中,試着和替換它們:

<!--[if IE 9]> 
    <link href="<?php bloginfo('stylesheet_directory'); ?>/ie.css" type="text/css" rel="stylesheet" /> 
<![endif]--> 
<!--[if IE 8]> 
    <link href="<?php bloginfo('stylesheet_directory'); ?>/ie8.css" type="text/css" rel="stylesheet" /> 
<![endif]--> 
+0

對不起,沒有工作:( – 30secondstosam 2012-04-23 19:25:53

+0

不需要對不起,請提供有關問題的更多信息,所以我們可以提供幫助 – 2012-04-23 19:30:17

+0

行 - 所以現在我有這個 '<! - [if IE 9]> <鏈接href =「<?php bloginfo('stylesheet_directory');?>/ie.css」type =「text/css」rel =「stylesheet」/> ' This works up!所有版本的IE瀏覽器,而不僅僅是IE 9。 壞消息是IE 8沒有工作,它根本沒有收到任何東西。 我已經編碼了整個網站,我無法相信我是找到這個最難的部分:/ 再次感謝!! – 30secondstosam 2012-04-23 19:32:48

相關問題