Html 为样式表创建有效的条件注释,不带';虚假评论';验证程序错误

Html 为样式表创建有效的条件注释,不带';虚假评论';验证程序错误,html,validation,conditional-comments,Html,Validation,Conditional Comments,我的头牌上有以下内容: <link rel="stylesheet" href="Scripts/styleMain.css" media="all" type="text/css" /> <![if gte IE 9]><!--> <link rel="stylesheet" href="Scripts/styleMob.css" media="screen and (max-width:500px)" type="text/css" /> &l

我的头牌上有以下内容:

<link rel="stylesheet" href="Scripts/styleMain.css" media="all" type="text/css" />
<![if gte IE 9]><!-->
<link rel="stylesheet" href="Scripts/styleMob.css" media="screen and (max-width:500px)" type="text/css" />
<link rel="stylesheet" href="Scripts/styleDes.css" media="screen and (min-width:501px)" type="text/css" />
<!--<![endif]-->
<!--[if lt IE 9]>
<link rel="stylesheet" href="styleDes.css" type="text/css" />
<![endif]-->

问题是,第二行被认为是虚假的注释,同一行上的第二个标记被认为是注释的过早结束

在同一行和第一个endif上有额外的标记只会给我两个虚假的注释错误

有没有办法让我的样式表带有条件,并让它们进行验证?或者我注定会有无效的代码,这会困扰我的OCD编码吗?

这应该行得通

<link rel="stylesheet" href="Scripts/styleMain.css" media="all" type="text/css" />
<!--[if gte IE 9]>
<link rel="stylesheet" href="Scripts/styleMob.css" media="screen and (max-width:500px)" type="text/css" />
<link rel="stylesheet" href="Scripts/styleDes.css" media="screen and (min-width:501px)"   type="text/css" />
<!--<![endif]-->
<!--[if lt IE 9]>
<link rel="stylesheet" href="styleDes.css" type="text/css" />
<![endif]-->

第二行的开头注释分隔符位置错误:

<!--[if gte IE 9]><!-->

您的代码中没有突出显示为注释的部分将是IE9和更高版本以及其他浏览器如何查看您的标记。旧版IE只会看到您的第一个和最后一个
元素。

尝试使用,而不是像魔咒一样工作。干杯
<link rel="stylesheet" href="Scripts/styleMain.css" media="all" type="text/css" />
<!--[if gte IE 9]><!-->
<link rel="stylesheet" href="Scripts/styleMob.css" media="screen and (max-width:500px)" type="text/css" />
<link rel="stylesheet" href="Scripts/styleDes.css" media="screen and (min-width:501px)" type="text/css" />
<!--<![endif]-->
<!--[if lt IE 9]>
<link rel="stylesheet" href="styleDes.css" type="text/css" />
<![endif]-->