根据-6ren">
gpt4 book ai didi

css - Modernizr 加载但在 IE8 中没有变化

转载 作者:太空宇宙 更新时间:2023-11-04 04:01:22 25 4
gpt4 key购买 nike

我正在尝试将 Modernizr 添加到我的 wordpress 安装中。我通过在 wp_head() 之后添加以下行来做到这一点;在标题中:

<script src="<?php bloginfo('template_directory'); ?>/js/modernizr-custom.js"></script>

根据firebug,脚本已加载,但该脚本在IE8 中似乎没有效果。

我已将以下行添加到我的 CSS 中:

.borderradius body {
background: #c00;
}

在 firefox 中背景变成红色,在 IE8 中没有任何反应。

article, aside, details, figcaption, figure, footer, header, main, nav, section 设置在display: block;

我还可以做些什么来让它在 IE8 中工作?

非常感谢您的宝贵时间。

最佳答案

您需要 HTML Shim让 HTML5 元素在 <=IE8 中工作。在任何其他脚本之前包含该脚本,最好在您的 <head> 中.下一个你需要的是媒体查询/matchMedia polyfill,mediaqueries.js 可以正常工作,我也很幸运 respond.js .最后,如果你想要 CSS3 支持像 border-radius 这样的东西,你需要一个像 CSS3 Pie 这样的 polyfill。 ,包括它附带的用于支持旧版 IE 的 .HTC 文件。

这是我的入门样板的示例 <head> ,它主要基于 HTML5 Boilerplate(不包括 CSS3 Pie):

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title></title>

<link rel="stylesheet" type="text/css" media="all" href="css/screen.css" />
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>

关于css - Modernizr 加载但在 IE8 中没有变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22017779/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com