[英]Should i use <!DOCTYPE html> on every file?
I understand that i should allways use at the begining of my project webpage.我知道我应该始终在我的项目网页的开头使用。
Is this true ONLY for the main page (index) or every html and php file must have it also?这是否仅适用于主页(索引)或每个 html 和 php 文件也必须具有它?
You should use it on every html page just like mrlew said.你应该像mrlew所说的那样在每个html页面上使用它。 This tells the browser what version on html you are using.
这会告诉浏览器您使用的 html 版本。 Some strict browser can misplace some stuff and disable some other features if this line is not recongnisez.
如果这一行没有被识别,一些严格的浏览器可能会放错一些东西并禁用一些其他功能。
So let say you only put this on your index file, if the user go to another page /streamvideo and you didn't put this line, the html5 video player might just not work.所以假设你只把它放在你的索引文件中,如果用户转到另一个页面 /streamvideo 而你没有放置这一行,那么 html5 视频播放器可能无法工作。
This being said, most common browser will 'fix' stuff like this or 'assume' you're using html5.话虽如此,大多数常见的浏览器都会“修复”这样的东西,或者“假设”您使用的是 html5。
see http://www.html-5-tutorial.com/doctype.htm https://www.w3.org/QA/2002/04/valid-dtd-list.html (sorry i skipped the w3school link :P)参见http://www.html-5-tutorial.com/doctype.htm https://www.w3.org/QA/2002/04/valid-dtd-list.html (抱歉我跳过了 w3school 链接:P )
Opening these link made me think of another example i can give you.打开这些链接让我想到了另一个我可以给你的例子。 before html5, if you have frames in your web page, it would be accurate to use the frame set decralation.
在 html5 之前,如果您的网页中有框架,则使用框架集声明是准确的。
Nice example in the w3org link above.上面 w3org 链接中的好例子。 hope this clear things out.
希望这清楚。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.