【发布时间】:2011-10-07 03:50:34
【问题描述】:
我注意到在许多模板引擎中,在HTML5 Boilerplate、各种框架和普通php 站点中,no-js 类添加到<HTML> 标记上。
为什么要这样做?是否有某种默认浏览器行为会对此类做出反应?为什么总是包含它?如果没有 no-"no-js" 的情况并且可以直接处理 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]-->
如您所见,<html> 元素将始终具有此类。
有人可以解释为什么经常这样做吗?
【问题讨论】:
标签: javascript html modernizr html5boilerplate