我已经开始使用 Bootstrap 构建 WordPress 主题,但无法使其在旧版(6、7 和 8)IE 中正确显示。
我已将 html5shiv 和响应 js 文件存储在服务器上,并将条件放在 CSS 文件之后,但它仍然无法正确呈现 - 容器被拉长等。
目前所有 CSS 都硬编码在 header 中,因此不存在@import 问题。
我的代码是这样的-
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" />
<title>
Test </title>
<link href="<?php bloginfo('template_url');?>/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<?php wp_head(); ?>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="<?php bloginfo('template_url');?>/bootstrap/js/html5shiv.js"></script>
<script src="<?php bloginfo('template_url');?>/bootstrap/js/respond.js"></script>
<![endif]-->
</head>
我一遍又一遍地搜索互联网,但找不到 html5shiv 和响应修复程序不起作用的原因。有人有什么建议吗?
谢谢。
最佳答案
为了让 HTML5shiv 工作,你需要让你的脚本在 Head
中运行。您的代码和页面上运行的其他脚本之上,以便 HTML5shiv 可以首先运行。尝试将其移至其他脚本和 <?php wp_head(); ?>
之上打电话。
在 Stackoverflow 上发布了类似的问题
关于javascript - Bootstrap 在 IE8 中无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26148014/