javascript - Bootstrap 在 IE8 中无法正确显示

标签 javascript html css wordpress twitter-bootstrap

我已经开始使用 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/

相关文章:

javascript - 车轮事件中 "line"的高度是多少? (deltaMode = DOM_DELTA_LINE)

html - 绝对定位的 div 与相对子级的高度相同

css - 如何使用 Modernizr 检测是否支持 SVG CSS 背景?

javascript - Bootstrap 嵌套轮播事件控件

javascript - Phonegap 本地通知不执行任何操作

javascript - 如何通过缩小宽度隐藏固定位置的侧边菜单

javascript - 如何按顺序向各种按钮添加功能

javascript - Gigya 评论通知 - 在 Node 中生成签名

javascript - React Hooks useState() 与对象

javascript - Select2 加载具有现有值的页面