I'm using some HTML5 features on a web page and wondered what the best DOCTYPE is. Currently, this is the DOCTYPE and XMLNS:
我在网页上使用了一些HTML5功能,并想知道什么是最好的DOCTYPE。目前,这是DOCTYPE和XMLNS:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Should I use the new HTML 5 DOCTYPE?
我应该使用新的HTML 5 DOCTYPE吗?
<!DOCTYPE html>
Will older browsers (IE7, FF 2.x) recognize and render the page correctly? What's the best practice in this situation? Thanks.
旧版浏览器(IE7,FF 2.x)是否能正确识别和呈现页面?在这种情况下,最佳做法是什么?谢谢。
1 个解决方案
#1
12
Yes, older browsers will work fine. The reason "<!DOCTYPE html>" was chosen in HTML 5 is because it is the smallest a doctype can be and yet still trigger standards compliance mode on those browsers you mention.
是的,旧的浏览器可以正常工作。在HTML 5中选择“”的原因是因为它是最小的doctype,但仍会在您提到的那些浏览器上触发标准合规模式。
#1
12
Yes, older browsers will work fine. The reason "<!DOCTYPE html>" was chosen in HTML 5 is because it is the smallest a doctype can be and yet still trigger standards compliance mode on those browsers you mention.
是的,旧的浏览器可以正常工作。在HTML 5中选择“”的原因是因为它是最小的doctype,但仍会在您提到的那些浏览器上触发标准合规模式。