I notice that in a lot of template engines, in the HTML5 Boilerplate , in various frameworks and in plain php sites there is the no-js
class added onto the <HTML>
tag.(我注意到在很多模板引擎中,在HTML5 Boilerplate中 ,在各种框架和普通的php站点中,在<HTML>
标记上添加了no-js
类。)
Why is this done?(为什么这样做?) Is there some sort of default browser behavior that reacts to this class?(是否存在某种对此类做出反应的默认浏览器行为?) Why include it always?(为什么总是包括它?) Does that not render the class itself obsolete, if there is no no-"no-js" case and html can be addressed directly?(如果没有no-“no-js”情况并且html可以直接解决,那么这不会使类本身过时吗?)
Here is an example from the HTML5 Boilerplate index.html:(以下是HTML5 Boilerplate index.html中的示例:)
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
As you can see, the <html>
element will always have this class.(如您所见, <html>
元素将始终具有此类。) Can someone explain why this is done so often?(有人可以解释为什么经常这样做吗?)
ask by Swader translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…