-1

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?

ndelucca
  • 517
  • 1
  • 8
  • 20
  • Use it for every page on your website, if you have a header.php file which you include for each page, put it oncein the header.php file. otherwise if you have to include it in each page – Web Dev Guy Feb 07 '17 at 02:32
  • 1
    Everytime you render `` tag. Not necessarily all scripts. – mrlew Feb 07 '17 at 02:32
  • Yes you should put the doctype in every file. If you don’t put a doctype on a document, browsers will go into [quirks mode](https://developer.mozilla.org/en-US/docs/Quirks_Mode_and_Standards_Mode) when rendering that document. And you (and your users) don’t want browsers to use quirks mode to render your documents. – sideshowbarker Feb 07 '17 at 02:49
  • Possible duplicate of [What is the functionality of !DOCTYPE?](http://stackoverflow.com/questions/1818587/what-is-the-functionality-of-doctype) – Tetsuya Yamamoto Feb 07 '17 at 04:21
  • The downvote seems misplaced....it's a fair question – ndelucca Feb 07 '17 at 11:34

1 Answers1

0

You should use it on every html page just like mrlew said. This tells the browser what version on html you are using. 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.

This being said, most common browser will 'fix' stuff like this or 'assume' you're using 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)

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.

Nice example in the w3org link above. hope this clear things out.

Louis Loudog Trottier
  • 1,367
  • 13
  • 26