为什么Firefox在红色中突出显示HTML过渡文档类型? [英] Why Firefox highlights HTML transitional doctype in red?

查看:251
本文介绍了为什么Firefox在红色中突出显示HTML过渡文档类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来Firefox似乎把它当作一个错误来对待。这是什么意思?





如果我将其更改为:

 < ;!DOCTYPE html> 
< html>

顺便说一下,我在Firefox 12.0上。

解决方案

如果您将鼠标悬停在红线上,Firefox会给出答案。



lockquote
几乎标准模式DOCTYPE。预期<!DOCTYPE html>


源也提示其错误doctype

 < span class =error doctypetitle =几乎标准模式的doctype。 <!DOCTYPE html>。> 
& lt;!DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd &安培; GT;
< / span>

问题是,Firefox需要<!DOCTYPE html> 作为标准模式文档类型



更新:

从上面给出的链接摘录。

lockquote

示例中显示的DOCTYPE <!DOCTYPE html> 是最简单的
可能的,并且是HTML5推荐的。较早版本的
HTML标准建议使用其他变体,但所有现有浏览器
今天都将对此DOCTYPE使用完全标准模式,即使是过时的
Internet Explorer 6 。没有正当的理由使用更多
复杂的DOCTYPE。如果您使用另一个DOCTYPE,您可能会冒
选择一个,这会触发几乎标准模式或怪癖模式。


It looks like Firefox is treating it like an error. What does this mean?

Firefox treats it normally if I change it to:

<!DOCTYPE html>
<html>

BTW I'm on Firefox 12.0

解决方案

If you hover over that red line, Firefox gives you the answer.

Almost standards mode doctype. Expected "<!DOCTYPE html>"

The markup of the View Source also hints its an error doctype

<span class="error doctype" title="Almost standards mode doctype. Expected "<!DOCTYPE html>".">
    &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
</span> 

The point is, Firefox wants <!DOCTYPE html> as the standard mode doc-type.

Update:

Excerpt from the above given link.

The DOCTYPE shown in the example, <!DOCTYPE html>, is the simplest possible, and the one recommended by HTML5. Earlier versions of the HTML standard recommended other variants, but all existing browsers today will use full standards mode for this DOCTYPE, even the dated Internet Explorer 6. There are no valid reasons to use a more complicated DOCTYPE. If you do use another DOCTYPE, you may risk choosing one, which triggers almost standards mode or quirks mode.

这篇关于为什么Firefox在红色中突出显示HTML过渡文档类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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