Internet Explorer 8不会修改打印样式表中的HTML5标签 [英] Internet Explorer 8 won't modify HTML5 tags in print stylesheet

查看:113
本文介绍了Internet Explorer 8不会修改打印样式表中的HTML5标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前正在处理打印样式表,并遇到了IE8的一个问题。我使用HTML5和几个布局标签,包括标题,导航和页脚。

由于某些原因,在我的打印样式表中,display:none;在IE8中这些标签声明被忽略(我只能假设后续的较低版本)。我首先想到IE9中的开发工具可能会导致虚假表示,但是我在VirtualBox中安装了Windows XP安装程序,它也显示了问题。



我猜是因为HTML5 IE9以下的任何东西都看不到标签。打印样式表隐藏了Firefox和Chrome中的布局标签。



有没有办法解决这个问题?



编辑:



以下是我现在的情况:

  < link rel =stylesheethref =<?php echo get_template_directory_uri();?> /style.csstype =text / cssmedia =screen/> 
< link rel =stylesheethref =<?php echo get_template_directory_uri();?> /css/print.csstype =text / cssmedia =print/>

忽略PHP语句,它们是特定于我的CMS,即WordPress。



然后我简单地将layout标签隐藏在print.css中:

  nav,footer { 
display:none;
}

这适用于IE9,Firefox,Chrome,但不能低于IE9。它似乎忽略了HTML5标签。 我建议您尝试 html5shiv 。主shiv会像> document.createElement()一样,但它已被疯狂优化/缩小。更重要的是,它包括 printshiv (IE Print Protector),它可以让你风格化用于打印的HTML5元素。


I was working on a print stylesheet earlier and came across a problem with IE8. I am using HTML5 and several layout tags including header, nav and footer.

For some reason in my print stylesheet the display:none; declaration on these tags is being ignored in IE8 (and I can only assume subsequent lower versions). I first thought that Developer Tools in IE9 could be causing a false representation, however I have a Windows XP installation in VirtualBox which shows the problem also.

My guess its because HTML5 tags aren't seen properly by anything below IE9. The print stylesheet hides the layout tags in Firefox and Chrome.

Is there anyway to get around this?

Edit:

Here is what I have at the moment:

<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/print.css" type="text/css" media="print" />

Ignore the PHP Statements, they are specific to my CMS which is WordPress.

Then I simply hide the layout tags in the print.css:

nav,footer { 
display:none;
}

This works for IE9, Firefox, Chrome but not in anything lower than IE9. It seems to ignore HTML5 tags.

解决方案

I suggest you try html5shiv. The main shiv does document.createElement() as you have but it's been optimized / minified like crazy. More importantly, it includes printshiv (IE Print Protector) which will let you style HTML5 elements for print.

这篇关于Internet Explorer 8不会修改打印样式表中的HTML5标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆