打开 Twitter 网站，查看源代码，要求面试者解释 Twitter 首页源代码的前 10 行，就是下面的这些代码：
以此来考察面试者对于 HTML 等知识的了解情况。
This is the document type (doc-type) declaration that we always put as the first line in HTML files. You might think that this information is redundant because the browser already knows that the MIME type of the response is text/html; but in the Netscape/Internet Explorer days, browsers had the difficult task of figuring out which HTML standard to use to render the page from multiple competing versions.
This was especially annoying because each standard generated a different layout so this tag was adopted to make it easy for browsers. Previously, DOCTYPE tags were long and even included the specification link (kinda like SVGs have today), but luckily the simple <!doctype html> was standardized in HTML5 and still lives on.
This is the DOCTYPE tag to let the browser know that this is an HTML5 page and should be rendered as such.
- Loading comments...