如何使用新的HTML5 Boilerplate定位IE9? [英] How to target IE9 with new HTML5 Boilerplate?

查看:214
本文介绍了如何使用新的HTML5 Boilerplate定位IE9?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为IE定位一个类。但是,由于样板模板已更改,因此不再有效。

  .myclass {
//做一些事情
}


.ie7 .myclass {
///做点什么

}

这是样板模板的新标题中的内容。

 <!doctype html> 
<! - [if lt IE 7]> < html class =no-js lt-ie9 lt-ie8 lt-ie7lang =en>百分比抑制率ENDIF] - GT!;
<! - [if IE 7]> < html class =no-js lt-ie9 lt-ie8lang =en>百分比抑制率ENDIF] - GT!;
<! - [if IE 8]> < html class =no-js lt-ie9lang =en>百分比抑制率ENDIF] - GT!;
<! - [if gt IE 8]><! - > < html class =no-jslang =en> <! - <![ENDIF] - GT;


解决方案

我们不建议您定位IE9,因为它全部现代浏览器的标记,这就是为什么我们没有IE9特定的条件类。如果您仍然愿意,可以使用:

 <!doctype html> 
<! - [if lt IE 7]> < html class =no-js lt-ie9 lt-ie8 lt-ie7lang =en>百分比抑制率ENDIF] - GT!;
<! - [if IE 7]> < html class =no-js lt-ie9 lt-ie8lang =en>百分比抑制率ENDIF] - GT!;
<! - [if IE 8]> < html class =no-js lt-ie9lang =en>百分比抑制率ENDIF] - GT!;
<! - [if IE 9]> < html class =no-js lt-ie10lang =en>百分比抑制率ENDIF] - GT!;
<! - [如果gt IE 9]><! - > < html class =no-jslang =en> <! - <![ENDIF] - GT;

请注意 IE10将无法​​识别条件注释

I am trying to target a class for IE. However, since the boilerplate template has changed this no longer works..

.myclass {
 //do something
}


.ie7 .myclass {
 ///do something

 }

This is what's in the new header of the boilerplate template.

<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

解决方案

We do not recommend you target IE9 as it has all the marking of a modern browser, which is why we do not have IE9 specific conditional class. If you still would like to, you can use:

<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if IE 9]>    <html class="no-js lt-ie10" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-js" lang="en"> <!--<![endif]--> 

Note that IE10 will not recognize conditional comments.

这篇关于如何使用新的HTML5 Boilerplate定位IE9?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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