本文介绍了如果我不输入<!DOCTYPE html>会怎样?在我的代码中?会发生重大变化吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用HTML处理多个项目,有时我忘了放<!DOCTYPE html>

解决方案

<!DOCTYPE>

<!DOCTYPE> 声明不是HTML标记;

很多IDE允许用户将其忽略,并默认使用特定的HTML。样式,但将其保留下来确实会对浏览器兼容性和旧版HTML的使用造成潜在威胁。



例如:新功能& HTML5中的标记,例如< article> <页脚> < header> &n; nav> ,<$ c如果未声明<!DOCTYPE> ,则可能不支持$ c>< section>



此外,浏览器可能会决定自动进入怪癖或严格模式。


I'm working on several projects with HTML, and sometimes I forget to put <!DOCTYPE html>. Will it make any big or noticeable changes?

解决方案

The <!DOCTYPE> declaration must be the very first thing in your HTML document, before the tag.

The <!DOCTYPE> 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 IDEs allow users to leave this out and 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.

这篇关于如果我不输入&lt;!DOCTYPE html&gt;会怎样?在我的代码中?会发生重大变化吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 16:27