[经典]IE与firefox关于注释的区别

 

原因是在Firefox(包括2、3)中,HTML注释中不能出现--(连续两个减号),否则会导致接下来的内容就会暴露出来。

<!--
--
这段中文会显示
-->

其它浏览器都是正常的,大家以后注意一下。

严格地来说,目前其实也不是Firefox的bug,因为HTML4中已经明确说不能这样写了~~~

http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.4

Firefox就是死不承认这是bug -_-! 虽然在HTML5中也认为这样写是错误的

http://www.w3.org/html/wg/html5/#comments

但是HTML5中明确了对于这种错误情况的处理是要忽略的

http://www.w3.org/html/wg/html5/#bogus

所以最终还将是Firefox的bug ~~~

3.2.4 Comments

HTML comments have the following syntax:

<!-- this is a comment -->
<!-- and so is this one,
    which occupies more than one line -->

White space is not permitted between the markup declaration open delimiter("<!") and the comment open delimiter ("--"), but is permitted between the comment close delimiter ("--") and the markup declaration close delimiter (">"). A common error is to include a string of hyphens ("---") within a comment. Authors should avoid putting two or more adjacent hyphens inside comments.

Information that appears between comments has no special meaning (e.g., character references are not interpreted as such).

Note that comments are markup.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值