我在页面中使用以下HTML5元素:header,article,section和nav.现在我将所有上面的HTML5元素设置为display:block,并在标题中包含带有条件语句的HTML5 shiv:
<!--[if lt IE 9]>
<script src="dist/html5shiv.js"></script>
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
该网站在IE7和IE8中运行良好 - 表明html5shiv确实在做它的魔力.但是当我在IE9中测试网站时,它缺乏HTML5元素内部所有内容的样式.
只要我将条件语句更改为:
<!--[if IE]>
<script src="dist/html5shiv.js"></script>
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
html5元素及其子元素现在可以应用正确的样式.我仔细检查了我的IE版本,它说我有IE版本9.0.8112.16421.
我还要提一下,这些站点是用PHP构建的,并通过使用PEAR的Cache_Lite进行缓存.但是,在一个简单的静态html页面上完成的测试为我提供了相同的结果.
有任何想法吗??
我有一个容器 div,里面有一个 SVG:
<!DOCTYPE html>
<body>
<div class="container">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="50" height="200">
<rect x="0" y="0" width="50" height="200" />
</svg>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
以及以下 CSS:
svg
{
width: 100%;
height: 100%;
}
div.container
{
width: 100%;
background-color: red;
}
Run Code Online (Sandbox Code Playgroud)
在 firefox、chrome 等中,容器 div 将与 svg 的高度匹配。然而 IE 的情况并非如此(我在 IE9 中测试过)。从 svg 样式块中删除 width/height: 100% 将解决此问题,但是我需要这些样式来缩放我的 SVG(在本示例 jsfiddle 中,我在 SVG 元素中省略了preserveAspectRatio)。
这是jsfiddle: http: //jsfiddle.net/Cx5jR/
我想我可以使用 Zoom:1 来强制 IE 识别 div 元素上的 hasLayout ,但这不起作用。
有任何想法吗?
下面是 IE9 中渲染效果的屏幕截图 - 请注意,div(红色背景)不会缩放到 SVG(黑色矩形)高度以下。

echo date('Y-m-d', strtotime('First Monday '.date('F o', strtotime("-4 months")));
Run Code Online (Sandbox Code Playgroud)
以上代码返回2012-10-08,这是不正确的 - 2012年10月的第一个星期一应该返回2012-10-01.
手册中的更改日志(http://php.net/manual/en/function.strtotime.php)指定以下内容:
In PHP 5 prior to 5.2.7, requesting a given occurrence of a given weekday in a
month where that weekday was the first day of the month would incorrectly add
one week to the returned timestamp.
This has been corrected in 5.2.7 and later versions.
Run Code Online (Sandbox Code Playgroud)
似乎很清楚,这是导致错误返回日期的原因,但是我使用的是PHP版本5.4.7(在localhost上运行xamp)!
有任何想法吗?