我创建了我的网站,作为二十世纪Wordpress的子主题。我已经集成了Bootstrap,一切都很好。IE8除外。页面一直处于移动视图中。
我遵循了Bootstraps页面上的说明,并在CSS后面的head标签中包含responsed.js。我还包括了html5shiv。但它仍然是一样的,页面是100%的宽度和所有一列。
我还尝试将http equiv设置为x-ua-compatible。我的头像标签是这样的:
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script src="<?php echo get_stylesheet_directory_uri(); ?>/js/respond.min.js"></script>
<![endif]-->
</head>
我的LESS样式表是这样开始的:
我知道response在用@import导入的CSS上不起作用,但第一次导入中的CSS不需要由responsd.js操作,Bootstrap导入是一个LESS导入,因此生成的CSS在同一个文件中有整个引导程序和我自己的引导程序。
/*
Theme Name: Public Web
Description: Public Web theme, responsive and HTML5 compatible
Author: Me
Author URI: http://stinaq.me
Template: twentythirteen
Version: 1.0.0
*/
@import url("../twentythirteen/style.css");
@import "bootstrap/bootstrap-min.less";
我已经尝试了Bootstrap的缩小版和常规版,以及IE(来自兼容模式和真正的IE8)。responsed.js是由浏览器找到的,所以也不可能是这样。
编辑:
我在本地XAMPP服务器上运行该站点,因此没有试图通过//文件访问responsed.js,而是通过localhost
我在wordpress中使用bootstrap 3时也遇到了类似的问题。它在IE8及更低版本之外的所有浏览器中都运行良好。媒体查询不再有效。今天我搞清楚发生了什么事。这是一个进口问题。我将所有CSS文件直接包含在头文件中,如下所示。
代码:
<link href="<?php bloginfo('template_url');?>/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
现在运行良好。
这个错误似乎完全不同。我之前遇到了一个不同的问题,这与html在检查器中没有正确显示有关。当我再次从头开始创建文件时,它突然起作用了。那次我使用Sublime而不是Visual Studio创建文件,所以编码似乎不正确。更多信息:https://wordpress.stackexchange.com/users/43535/squ