我的HTML输出为IE7 / IE8 / FF3 +推荐什么DOCTYPE?以及如何在Visual Studio中更新我的HTML验证以反映该更改? [英] What DOCTYPE is recommended for my HTML output for IE7/IE8/FF3+? and how can I update my HTML validation in Visual Studio to reflect that change?

查看:81
本文介绍了我的HTML输出为IE7 / IE8 / FF3 +推荐什么DOCTYPE?以及如何在Visual Studio中更新我的HTML验证以反映该更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到Visual Studio将DOCTYPE默认为XHTML 1.0 Transitional。这似乎没问题,但我认为这更像是第六代浏览器的标准。我们现在处于第7代和第8代浏览器,我想知道我应该将哪些DOCTYPE放入我的HTML中。



在相关说明中:有没有办法将其他DOCTYPE添加到Visual Studio 2008中的HTML验证中?工具>选项>文本编辑器> HTML>验证

解决方案

 <!doctype html> 

方式。这在所有体面的浏览器中都能正常工作,包括IE6(尽管如此,它并不算很好)。另请参阅 http://hsivonen.iki.fi/doctype/ 了解更多背景信息和浏览器行为table。

您也可以考虑严格XHTML,但为什么要将干净的HTML转换为XML格式?如果你想使用一些XML工具来解析/生成/验证HTML,这在现实世界中通常不是这样。 Google也只是使用<!doctype html> ,并且Stackoverflow使用HTML strict。


I noticed that Visual Studio defaults the DOCTYPE to XHTML 1.0 Transitional. This seems okay, but I think that's more of a standard for "generation 6" browsers. We're now in gen 7 and 8 browsers, and I'm wondering what DOCTYPE I should be putting in my HTML.

On a related note: Is there a way to add other DOCTYPEs to the HTML validation in Visual Studio 2008? Tools > Options > Text Editor > HTML > Validation

解决方案

<!doctype html>

is the way to go. This works fine in all decent browsers, including IE6 (not that it is a decent one though). Also see http://hsivonen.iki.fi/doctype/ for more background info and a browser behaviour table.

You could also consider XHTML strict, but why would you massage clean HTML into a XML format? It is only interesting if you want to parse/generate/validate HTML using some XML tool, which often isn't the case in real world. Google also just uses <!doctype html> and Stackoverflow uses nicely HTML strict.

这篇关于我的HTML输出为IE7 / IE8 / FF3 +推荐什么DOCTYPE?以及如何在Visual Studio中更新我的HTML验证以反映该更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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