Mixing HTML and XHTML !doctypes in one web site

I am developing a simple web site using HTML strict. Now I have a need for 1 page to be written in XHTML strict. The question is, can I simply write one page using a XHTML !doctype statement and make it work with the other HTML !doctype pages?

Yes, the doctype works on a page by page basis. I’m a bit dubious about the idea that one page “needs” a certain doctype. How did you arrive at that conclusion?

Hi Ralph and thanks for the reply. The last page I am working on involves a photo gallery. I found some very specific advice on how to do that. the example is quite verbose with lots of source code. the author warns that if you do not use XHTML with her examples “lots” of browsers will go into quirks mode and not display images correctly.

She is really warning you against not having a doctype at all. It doesn’t matter which one it is, as long as you have one. These days it’s the norm just to use the simple (so called HTML5 doctype, though it’s not really) doctype:

<!DOCTYPE html>

A few years ago, the fad was to use an XHTML doctype served as text/html, so people tended not even to acknowledge that there were any alternatives, whereas these days, the fad has moved on, just like all other fashions. :lol:

I agree with Ralph. If you’re serving the page as text/html, then it doesn’t actually matter which doctype you use. Browsers treat them all the same.

cool, and thanks for the clarification.