如果我不放置<!DOCTYPE html>会发生什么?在我的代码?它会做出重大改变吗? [英] What happens if I dont put a <!DOCTYPE html> in my code? Will it make any major changes?
问题描述
声明必须是HTML文档中的第一件事, 。
声明不是HTML标签;它是网页浏览器关于写入页面的HTML版本的指令。
许多IDE允许用户将其保留,并且默认为某个特定的HTML风格,但是将其留在浏览器兼容性和使用老版本的HTML中会造成潜在的威胁。
例如:新功能& HTML5中的标签,例如<文章>,<页脚>,<标题>,< nav>,<如果未声明Doctype,可能不支持
此外,浏览器可能会自动进入Quirks或Strict Mode。
So im working on several projects with html, and sometimes i forget to put <!DOCTYPE html>
. Will it make any big or noticable changes?
The declaration must be the very first thing in your HTML document, before the tag.
The declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.
A lot of IDE's allow users to leave this out and simply default to a certain HTML style, but leaving it out does pose a potential threat in browser compatibility and the use of older versions of HTML.
For example: new features & tags in HTML5 such as < article >,< footer >, < header >, < nav >, < section > may not be supported if the Doctype is not declared.
Additionally, the browser may decide to automatically go into Quirks or Strict Mode.
这篇关于如果我不放置<!DOCTYPE html>会发生什么?在我的代码?它会做出重大改变吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!