0

I am confused why this webpage has doctype of xhtml strict and .html extension. I have read on the internet that, the file extension changes the way server handles the webpage. For example, even though we use xhtml doctype, but if webpage extension is .html, than that page is treated as html, not xhtml. Then what is the use of xhtml doctype. Does xhtml used nowadays by web developers or they simply use html 5 ? Thank you in advance.

Similar page in xhtml extension is this. View page source for better understanding.

novato
  • 113
  • 2
  • 10
  • 1
    The file extension *can* change the way the server handles the webpage. It's not the only way the mime type can be set. So it's possible to have a true XHTML page with a `.html` extension. But an XHTML doctype is really just for page validation. And XHTML 1.x is obsolete. If you want XHTML, use the XHTML serialization of HTML5. Which uses either ` ` or you can safely omit the doctype for XHTML5. – Alohci Sep 05 '17 at 11:05
  • That said, if the file type *IS* HTML, leaving out the doctype declaration will trigger quirks mode. So having an XHTML doctype declaration is just as good as any other doctype declaration if you want to avoid that. – Mr Lister Sep 10 '17 at 19:06
  • Possible duplicate of [Why put an XHTML doctype declaration on HTML files? What does that do?](https://stackoverflow.com/questions/8871901/why-put-an-xhtml-doctype-declaration-on-html-files-what-does-that-do) – Mr Lister Sep 11 '17 at 11:10

0 Answers0